Description Usage Arguments Value References See Also Examples
psmultilevel
is a general function, making calls to
multi.ate
and multi.att
depending on the estimand of interest.
It implements a variety of algorithms for calculating propensity score
weighting estimators and their standard errors for treatment effects in a
clustered data setting. Here, the treatment is assigned on an individual
level and not cluster level. This function has an optional threshold for the minimum
number of units in each treatment group of each cluster - clusters that don't
meet this requirement are removed before the propensity scores are
estimated.
psmultilevel
offers four weighting
estimators: marginal weighting, clustered weighting, stratification, and
doubly-robust. Standard errors include closed-form formula when available
(Lunceford and Davidian 2004), as well as values obtained by bootstrapping.
1 2 3 | psmultilevel(data, Y, Z, cluster, y.formula = NULL, pscore.formula, estimand,
method, modeltype = "fixed", y.type, se.report = FALSE, nboot = 75,
nsub = 6, ps.cut = c(0.05, 0.95), cl.cutoff = 0)
|
data |
Data containing covariates except for the outcome, the treatment, and the cluster identification. |
Y |
A vector containing the outcome of interest. This can be either binary or continuous, but will need to be specified for methods involving outcome models. |
Z |
A vector indicating the observations which are in the treated and control group. This is binary-coded: 1 = Treated, 0 = Untreated. |
cluster |
A vector of factored cluster identification. |
y.formula |
Outcome formula, required for Doubly-Robust. The treatment variable should be called "Z" and the cluster variable should be named "cluster". |
pscore.formula |
Propensity score formula. The treatment variable should be called "Z" and the cluster variable should be named "cluster". |
estimand |
A character string for the estimand, either "ATE", the sample average treatment effect, or "ATT", the sample average treatment effect for the treated. |
method |
A character string for the method of interest. Options: "marwt" for marginal weighting, "clwt" for clustered weighting, "stratification" for stratification/ subclassification, and "DR" for doubly-robust. |
modeltype |
A character string identifying the model of the cluster-specific
effects for both the propensity score and the outcome. Options: "fixed" for a fixed effects model, and
"random" for a random effects model. Default: fixed effects model. Note that for random
effects models, function |
y.type |
A character string classifying the outcome type. Options: "binary"/ "continuous". |
se.report |
A logical flag for whether the standard error for the estimator should be reported. |
nboot |
The number of bootstrap samples to be drawn. Default value is 75. |
nsub |
A scalar denoting the number of subclasses to be used for stratification. Default value is 6. |
ps.cut |
A vector of length 2 containing the lower and upper limit for the propensity scores cut-offs. Observations beyond these limits are removed. Default values are (0.05,0.95). |
cl.cutoff |
A scalar denoting the minimum number of observations required in both the treatment and the control groups. Clusters with fewer observations than the threshold in either group will be removed before the estimation process. Default value is 0. |
A list with the elements:
estimate |
Value of the estimator of interest. |
se |
The standard error of the estimator. Closed-form formula is available for ATE Doubly-Robust (Lunceford and Davidian 2004). Bootstrapping is implemented to calculate SEs for the rest of the estimators. |
Lunceford, J. K. and Davidian, M. (2004), Stratification and weighting via the propensity score in estimation of causal treatment effects: a comparative study. Statist. Med., 23: 2937<e2><80><93>2960. doi:10.1002/sim.1903
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | y.formula.re<-function(){
return (Y~Z+X1+X2+(1|cluster))
}
ps.formula.re<-function(){
return(Z~ X1+X2+ (1|cluster))
}
data<-simdata[,c(1:2)]
psmultilevel(data=data,Y=simdata$Y,Z=simdata$Z,cluster=simdata$cluster,y.formula=NULL,
pscore.formula=ps.formula.re(),estimand='ATE',method='marwt',modeltype='random',y.type=NULL,
se.report=FALSE,ps.cut=c(0.05,0.95),cl.cutoff=0)
## Not run:
psmultilevel(data=data,Y=simdata$Y,Z=simdata$Z,cluster=simdata$cluster,
y.formula = y.formula.re(),pscore.formula=ps.formula.re(),estimand='ATE',
method='DR',modeltype='random',y.type='continuous',se.report=TRUE,
ps.cut=c(0.05,0.95),cl.cutoff=3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.