biasLovePlot | R Documentation |
biasLovePlot
creates a Love plot of the bias across the treatment and the instrument. Can also display the permutation quantiles for these quantities. Note that the bias is different for the treatment than for the instrument, as discussed in Equation (3) of Branson and Keele (2020). This function is used to create Figure 3b in Branson and Keele (2020).
biasLovePlot(X, D, Z, permQuantiles = FALSE, alpha = 0.05, perms = 1000)
X |
Covariate matrix (with units as rows and covariates as columns). |
D |
Indicator vector for a binary treatment (must contain 1 or 0 for each unit). |
Z |
Indicator vector for a binary instrument (must contain 1 or 0 for each unit). |
permQuantiles |
If |
alpha |
The significance level used for the permutation quantiles. For example, if |
perms |
Number of permutations used to approximate the permutation quantiles. |
Plot of the bias across the treatment and the instrument.
Zach Branson and Luke Keele
Branson, Z. and Keele, L. (2020). Evaluating a Key Instrumental Variable Assumption Using Randomization Tests. American Journal of Epidemiology. To appear.
#load the data
data(icu.data)
#the covariate matrix is
X = as.matrix(subset(icu.data, select = -c(open_bin, icu_bed)))
#the treatment
D = icu.data$icu_bed
#the instrument
Z = icu.data$open_bin
#make the Love plot with permutation quantiles
## Not run: biasLovePlot(X = X, D = D, Z = Z, permQuantiles = TRUE, perms = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.