causalsens {causalsens} | R Documentation |
Calculate sensitivity of causal estimates to unmeasured confounding.
Description
This function performs a sensitivity analysis of causal effects different assumptions about unmeasured confounding, as described by Blackwell (2013).
Usage
causalsens(
model.y,
model.t,
cov.form,
confound = one.sided,
data,
alpha,
level = 0.95
)
Arguments
model.y |
outcome model object. Currently only handles
|
model.t |
propensity score model. Currently assumes a
|
cov.form |
one-sided formula to describe any covariates to be included in the parital R^2 calculations. |
confound |
function that calculates the confounding
function. This function must take arguments |
data |
data frame to find the covariates from |
alpha |
vector of confounding values to pass the confounding function. Defaults to 11 points from -0.5 to 0.5 for binary outcome variable, and 11 points covering the a interval with width equal to the inter-quartile range and centered at 0 for non-binary outcome variables. |
level |
level of the confidence interval returned. |
Value
Returns an object of class causalsens
.
-
sens
data frame containing alpha values, partial R^2s, estimates, and 95 -
partial.r2
vector of partial R^2 values for the covariates to compare to sensitivity analysis results.
Examples
data(lalonde.exp)
ymodel <- lm(re78 ~ treat+age + education + black + hispanic +
married + nodegree + re74 + re75 + u74 + u75, data = lalonde.exp)
pmodel <- glm(treat ~ age + education + black + hispanic + married
+ nodegree + re74 + re75 + u74 + u75, data = lalonde.exp,
family = binomial())
alpha <- seq(-4500, 4500, by = 250)
ll.sens <- causalsens(ymodel, pmodel, ~ age + education, data =
lalonde.exp, alpha = alpha, confound = one.sided.att)