Description Usage Arguments Value Author(s) References See Also Examples
Estimate average treatment effects using two-stage least squares with a binary instrument and binary treatment and weighting with inverse complier scores (probabilities of compliance). Optionally, bootstrap the entire estimation process for the purpose of hypothesis testing and constructing confidence intervals.
| 1 2 3 4 5 6 7 8 9 | 
| D | Binary treatment of interest. | 
| X | Matrix of covariates for two-stage least squares. Add a constant if desired (see examples). | 
| Y | Outcome. | 
| Z | Binary instrument. | 
| W | Matrix of covariates for compliance model. | 
| weights | Observation weights. | 
| R | Number of bootstrap replicates. | 
| estimand | Whether to estimate average treatment effect (default) or average treatment effect on the treated. | 
| min.prob.quantile | Compliance scores are truncated to this quantile of positive compliance scores. | 
| min.prob | Compliance scores are truncated to this value. | 
| ... | Additional arguments to  | 
If R = 0 or icsw.tsls.fit is called directly, a model fit,
as described in lm.wfit.
If R > 0, a list with elements
| fitted.model | A model fit, as returned by  | 
| coefs.boot | p by R matrix of model coefficients for each of R bootstrap replicates. | 
| coefs.se.boot | Vector of standard deviations of coefficients under bootstrap resampling (i.e., bootstrap standard errors). | 
Peter M. Aronow <peter.aronow@yale.edu>; Dean Eckles <icsw@deaneckles.com>; Kyle Peyton <kyle.peyton@yale.edu>
Peter M. Aronow and Allison Carnegie. (2013). Beyond LATE: Estimation of the average treatment effect with an instrumental variable. Political Analysis.
compliance.score for calculating compliance scores used in example. 
tsls.wfit for regression via 2SLS with weights. 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Load example dataset, see help(FoxDebate) for details
data(FoxDebate)
# Ipw reweighting step Aronow and Carnegie (2013) use for missing data
covmat <- with(FoxDebate, cbind(partyid, pnintst, watchnat, educad, readnews, gender, 
                                income, white))
# IPW reweighting step Aronow and Carnegie (2013) use for missing data
Ymis <- is.na(FoxDebate[, "infopro"])
IPWweight <- 1 / (1 - predict(glm(Ymis ~ covmat, family = binomial(link = "probit")),
                                  type = "response"))
IPWweight[Ymis] <- 0
N <- length(FoxDebate[, "infopro"])
alpha <- 0.275
# Compute the ATE of watching the Fox Debate on knowledge . This replicates the 
#   ATE from column 2 of Table 1 in Aronow and Carnegie (2013) 
icsw.out <- with(FoxDebate, icsw.tsls(D = watchpro, X = cbind(1, covmat), 
                                          Y = infopro, Z = conditn, W = covmat,
                                          min.prob.quantile = 1 / (N^alpha),
                          weights = IPWweight))
round(icsw.out$coefficients["D"], 2)
# Example with bootstrap (this takes awhile!)
icsw.out <- with(FoxDebate, icsw.tsls(D = watchpro, X = cbind(1, covmat), 
                                      Y = infopro, Z = conditn, W = covmat,
                                      min.prob.quantile = 1 / (N^alpha), 
                                      weights = IPWweight, R = 1000))
# Display vector of coefficients
icsw.out$coefficients
# Display vector of (bootstrapped) SEs
icsw.out$coefs.se.boot
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.