*! version 1.2.1 18Feb2017
help mmws

Title

mmws -- Marginal mean weighting through stratification

Syntax

mmws treat [if] [in]
,
pscore(varlist)
[ strata(varlist)
nstrata(numlist)
ordinal
tlevel(#)
nominal
att
iptw
common
figure
replace
prefix(string)
]

treat must contain integer values representing the treatment levels

Description

mmws implements a method, originally proposed by Huang et al (2005), extended by Hong (2010, 2012), and further described by
Linden (2014) that combines elements of two propensity score-based techniques, stratification and weighting.
mmws is a data pre-processing procedure that reweights a dataset to balance the observed pretreatment characteristics
across all treatment groups. Under the ignorability assumption, the weighted data should approximate a randomized experiment. The weights
generated by mmws can then be passed to the appropriate outcome model for use in subsequent analyses.

Before using mmws, the propensity score for a given treatment must be estimated. A logit or probit regression model can be used for estimating the propensity score
for a binary treatment; an ordinal logit or probit regression model can be used to estimate the propensity score for a treatment with ordered levels
(e.g. varying doses of a drug); and a multinomial logistic or probit regression can be used for estimating propensity scores for nominal (independent) treatments.

Options

pscore(varlist) required. For binary or ordinal level treatments, one propensity score must
be provided. For multiple nominal level treatments, one propensity score must be provided for each treatment level and they must be
ordered correspondingly (e.g. ps1 ps2 ps3 correspond to treatment levels 0 1 2, respectively).

strata(varlist) is a variable containing quantile categories of the propensity score. There should be one variable provided for
each corresponding propensity score. Thus, for binary or ordinal level treatments, there should be only one strata variable provided. In the
case of multiple nominal level treatments, there must be a strata variable provided that corresponds to each propensity score
(e.g. strata1 strata1 strata3 correspond to ps1 ps2 ps3, respectively). The user should consider implementing pstrata as a means of generating optimal
strata for each propensity score. pstrata can be downloaded from SSC.

nstrata(numlist) when strata is not provided by the user, mmws will generate a strata variable containing a specified number
of quantile categories of the propensity score. There should be one value specified for each corresponding propensity score
(e.g. 5 3 10 are three quantile categories corresponding to ps1 ps2 ps3, respectively); default is 5 quantiles for each stratum.
nstrata cannot be combined with strata.

ordinal specifies that the treatment variable contains more than two ordered levels (i.e. increasing doses of a drug).

tlevel(#) used only in conjunction with ordinal and common. It specifies which treatment level defines common support. Typically this would
coincide with the treatment level for which the propensity score was estimated in the ologit model (e.g. predict pscore, pr outcome(3) indicates that the propensity
score is estimated based on treatment level coded as 3). When tlevel is not specified, the ordinal treatment coded with the lowest value is used for common support.

nominal specifies that the treatment variable contains more than two nominal levels (i.e. treatment A, treatment B and treatment C).

att specifies that the weights generated by mmws are for estimating the average treatment effect on the treated (ATT); available only for binary treatments.

iptw generates inverse probability of treatment weights (IPTW) in addition to the mmws weights. When iptw is specified in conjunction
with att, the weight is computed as an ATT weight (this option is available only for binary treatments), otherwise iptw is computed to estimate
the average treatment effect (ATE). The point estimates derived from an outcome model using the iptw as a pweight will be identical to those derived
using teffects ipw (however the standard errors will likely differ because teffects ipw estimates standard errors via GMM).

common generates weights for those observations within the region of common support, and gives a weight of zero to observations not on common support.
An indicator or dummy variable named _support is added to the dataset to identify the observations on common support. Note: If the
option common is chosen together with nstrata(), mmws will first establish which units are on common support, and then generate the
strata variable based on this subset of the sample. However, If the option common is chosen together with a user supplied strata variable via strata(),
then common support will be based on the user supplied strata variable. Thus, the two approaches may result in different samples and
weights being generated. Hong (2012), espouses the first approach, that is, first establish the region of common support, and then generate the quantiles
for the sample on common support (implemented in mmws by specifying nstrata() and common together).

figure a histogram of the propensity score is generated (with a kernel density overlay) to illustrate the overlap of each level of treatment. For nominal treatments,
a histogram is generated for each propensity score. The minimum and maximum values of common support are presented as vertical lines. When common is specified, only
values of the propensity scores within common support are presented, otherwise all values are presented.

replace replaces variables created by mmws if they already exist. If prefix() is specified, only variables created by mmws with
the same prefix will be replaced.

prefix(string) adds a prefix to the names of variables created by mmws. Short prefixes are recommended.

Variables added to the dataset

mmws generates several variables for the convenience of the user. If the user specifies a prefix(), it will naturally be applied:

_strata: if the strata() option is used, then _strata will be a clone of the variable specified in strata(). For nominal treatments,
there will necessarily be multiple _strata generated, each with a suffix indicating which propensity score it is associated with (as will the variable label).
If the nstrata() option is selected, then _strata will be the result of that chosen option

_support: an indicator or dummy variable indicating whether an observation is on common support

_mmws: the weight generated by mmws. The variable label will provide a brief description

_iptw: the inverse probability of treatment weight generated, when the iptw option is specified

Examples

There are at least three general scenarios in which mmws can be
implemented: (1) a binary treatment in which one treatment group is compared to one control group;
(2) an ordinal (or continuous) level treatment in which groups receiving the various levels of the intervention are compared;
and (3) a multiple nominal level treatment in which groups receiving different interventions are compared. The examples
below are described accordingly:

(1) Binary treatment

Load example data

. webuse cattaneo2, clear

Estimate propensity score for the binary treatment mbsmoke and create a strata variable with 6 quantiles

. logit mbsmoke mmarried c.mage##c.mage fbaby medu

. predict pscore, pr

. xtile strata1 = pscore, nq(6)

Alternately, an optimized strata variable can be generated using pstrata

. pstrata mbsmoke, ps(pscore)

Generate weights using the strata variable created in the previous step

. mmws mbsmoke, pscore(pscore) strata(strata1)

Examine covariate balance of the variable mage using qqplot3 using the weights generated in the previous run

. qqplot3 mage [pw=_mmws], by(mbsmoke)

Generate weights using nstrata to create the strata variable with 5 quantiles, and plot a histogram to examine the overlap
between treatment and control groups on the propensity score

. mmws mbsmoke, pscore(pscore) nstrata(5) replace fig

Generate ATT weights with common support

. mmws mbsmoke, pscore(pscore) nstrata(5) att common replace

Generate both MMWS and IPTW weights fo ATT estimator with common support

. mmws mbsmoke, pscore(pscore) nstrata(5) att iptw common replace

Estimate average treatment effect on the treated (ATT) of mbsmoke on bweight using MMWS weights generated in the previous run

. regress bweight mbsmoke [pw=_mmws], robust

Estimate average treatment effect on the treated (ATT) of mbsmoke on bweight using IPTW weights generated in the previous run

. regress bweight mbsmoke [pw=_iptw], robust

Examine covariate balance of the variable mage using a box-plot using the weights generated in the previous run

. graph box mage [pw=_mmws], over(mbsmoke)

(2) Ordinal level treatments

Load example data

. use http://www.stata-press.com/data/r13/bdsianesi5.dta, clear

Estimate propensity score for the ordinal treatment ed based on the lowest treatment level (0) and create a strata variable with 10 quantiles

. ologit ed london eastern paed math7

. predict pscore, pr outcome(0)

. xtile strata = pscore, nq(10)

Generate weights for an ordinal treatment using the strata variable created in the previous step

. mmws ed, pscore(pscore) ordinal strata(strata)

Generate weights using nstrata to create the strata variable with 5 quantiles, and plot
a histogram to examine the overlap amongst levels of treatment on the propensity score

. mmws ed, pscore(pscore) ordinal nstrata(5) replace fig

Generate weights for an ordinal treatment using nstrata and specify that common support should be defined by treatment level 0

. mmws ed, pscore(pscore) ordinal tlevel(0) common nstrata(5) replace fig

Examine covariate balance of the variable paed using a box-plot with the weights generated in the previous run

. graph box paed [pw=_mmws], over(ed)

Estimate average treatment effect of levels of ed on wage using weights generated in the previous run

. regress wage i.ed [pw=_mmws], robust

Run margins to get reweighted mean wage for each level of ed

. margins ed

Run marginsplot to visually display reweighted mean wage for each level of ed

. marginsplot, plotopts(connect(i))

Run margins to get contrasts between each level of ed and the base level (0)

. margins r.ed

(3) Multiple nominal treatments

Load example data

. webuse cattaneo2, clear

Estimate propensity scores for the four treatment levels of msmoke and generate four strata variables corresponding to each treatment, respectively

. mlogit msmoke i.(mmarried fbaby) mage c.mage#c.mage medu c.medu#c.medu c.mage#c.medu, base(0)

. predict double (ps1 ps2 ps3 ps4), pr

Generate weights for nominal treatments using the nstrata option and common support. Show overlap graph.

. mmws msmoke, pscore(ps1 ps2 ps3 ps4) nominal nstrata(5 6 7 8) common replace fig

Estimate average treatment effect of each level of msmoke on bweight using MMWS weights generated in the previous run

. regress bweight i.msmoke [pw=_mmws], robust

Run margins to get reweighted mean bweight for each level of msmoke

. margins msmoke

Run marginsplot to visually display reweighted mean bweight for each level of msmoke

. marginsplot, plotopts(connect(i))

Run pairwise comparisons between reweighted treatment levels, with Bonferroni adjustment for multiple tests

. margins msmoke, pwcompare(effects) mcompare(bonferroni)

Saved results

By default, mmws returns the following results, which
can be displayed by typing return list after
mmws is finished (see return).

Scalars

r(suppmin) the minimum value of common support (will have a suffix for nominal treatments)

r(suppmax) the maximum value of common support (will have a suffix for nominal treatments)

References

Hong, G. 2010. Marginal mean weighting through stratification: adjustment for selection bias in multilevel data.
Journal of Educational and Behavioral Statistics 35: 499-531.

Hong, G. 2012. Marginal mean weighting through stratification: a generalized method for evaluating multi-valued
and multiple treatments with non-experimental data. Psychological Methods 17: 44-60.

Huang, I.-C., Frangakis, C., Dominici, F., Diette, G. B., Wu, A. W. 2005. Application of a propensity score
approach for risk adjustment in profiling multiple physician groups on asthma care. Health Services Research 40: 253-278.

Linden, A. 2014. Combining propensity score-based stratification and weighting to improve
causal inference in the evaluation of health care interventions. Journal of Evaluation in Clinical Practice 20: 1065-1071.

Linden, A. 2017a. Improving casual inference with a doubly robust estimator that combines propensity score stratification and weighting.
Journal of Evaluation in Clinical Practice DOI:10.1111/jep.12714

Linden, A. 2017b. A comparison of approaches for stratifying on the propensity score to reduce bias.
Journal of Evaluation in Clinical Practice DOI:10.1111/jep.12701

Linden, A. & Adams, J. L. (2008) Improving participant selection in disease management programs: insights gained from propensity score
stratification. Journal of Evaluation in Clinical Practice, 14, 914–918.

Linden, A., Uysal, S. D., Ryan, A., & Adams, J. L. (2016) Estimating causal effects for multivalued treatments:
A comparison of approaches. Statistics in Medicine 35: 534-552.

Nichols, A. 2008. Erratum and discussion of propensity-score reweighting. Stata Journal 8: 532-539.

Robins, J. M., Hernan, M. A., Brumback B. 2000. Marginal Structural Models and Causal Inference in Epidemiology. Epidemiology 11: 550-560.

Sato, T., Matsuyama, Y. 2003. Marginal Structural Models as a Tool for Standardization. Epidemiology 14: 680-686.

Citation of mmws

mmws is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden, Ariel. 2014.
MMWS: Stata module for implementing mean marginal weighting through stratification. http://ideas.repec.org/c/boc/bocode/s457886.html

Author

Ariel Linden

President, Linden Consulting Group, LLC

Ann Arbor, MI, USA

alinden@lindenconsulting.org

http://www.lindenconsulting.org

Acknowledgments

I wish to thank Nicholas J. Cox for his support while developing mmws, and to Paul Walsh for pointing out a bug in the code for IPTW in the nominal treatment case.

Also see

Online: xtile, logit, ologit, mlogit, margins, marginsplot, teffects,
pstrata (if installed), qqplot3 (if installed), covbal (if installed), drmmws (if installed)