adjusted_estimate {sensemakr} | R Documentation |
Bias-adjusted estimates, standard-errors, t-values and confidence intervals
Description
These functions compute bias adjusted estimates (adjusted_estimate
),
standard-errors (adjusted_se
) and t-values (adjusted_t
),
given a hypothetical strength of the confounder in the partial R2 parameterization.
The functions work either with an lm
object, or directly
passing in numerical inputs, such as the
current coefficient estimate, standard error and degrees of freedom.
Usage
adjusted_estimate(...)
## S3 method for class 'lm'
adjusted_estimate(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, ...)
## S3 method for class 'fixest'
adjusted_estimate(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, ...)
## S3 method for class 'numeric'
adjusted_estimate(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, ...)
adjusted_se(...)
## S3 method for class 'numeric'
adjusted_se(se, dof, r2dz.x, r2yz.dx, ...)
## S3 method for class 'lm'
adjusted_se(model, treatment, r2dz.x, r2yz.dx, ...)
## S3 method for class 'fixest'
adjusted_se(model, treatment, r2dz.x, r2yz.dx, message = TRUE, ...)
adjusted_ci(...)
## S3 method for class 'lm'
adjusted_ci(
model,
treatment,
r2dz.x,
r2yz.dx,
which = c("both", "lwr", "upr"),
reduce = TRUE,
alpha = 0.05,
...
)
## S3 method for class 'fixest'
adjusted_ci(
model,
treatment,
r2dz.x,
r2yz.dx,
which = c("both", "lwr", "upr"),
reduce = TRUE,
alpha = 0.05,
message = T,
...
)
## S3 method for class 'numeric'
adjusted_ci(
estimate,
se,
dof,
r2dz.x,
r2yz.dx,
which = c("both", "lwr", "upr"),
reduce = TRUE,
alpha = 0.05,
...
)
adjusted_t(...)
## S3 method for class 'lm'
adjusted_t(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)
## S3 method for class 'fixest'
adjusted_t(
model,
treatment,
r2dz.x,
r2yz.dx,
reduce = TRUE,
h0 = 0,
message = T,
...
)
## S3 method for class 'numeric'
adjusted_t(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)
adjusted_partial_r2(...)
## S3 method for class 'numeric'
adjusted_partial_r2(
estimate,
se,
dof,
r2dz.x,
r2yz.dx,
reduce = TRUE,
h0 = 0,
...
)
## S3 method for class 'lm'
adjusted_partial_r2(
model,
treatment,
r2dz.x,
r2yz.dx,
reduce = TRUE,
h0 = 0,
...
)
## S3 method for class 'fixest'
adjusted_partial_r2(
model,
treatment,
r2dz.x,
r2yz.dx,
reduce = TRUE,
h0 = 0,
...
)
bias(...)
## S3 method for class 'numeric'
bias(se, dof, r2dz.x, r2yz.dx, ...)
## S3 method for class 'lm'
bias(model, treatment, r2dz.x, r2yz.dx, ...)
## S3 method for class 'fixest'
bias(model, treatment, r2dz.x, r2yz.dx, ...)
relative_bias(...)
## S3 method for class 'lm'
relative_bias(model, treatment, r2dz.x, r2yz.dx, ...)
## S3 method for class 'fixest'
relative_bias(model, treatment, r2dz.x, r2yz.dx, ...)
## S3 method for class 'numeric'
relative_bias(estimate, se, dof, r2dz.x, r2yz.dx, ...)
rel_bias(r.est, est)
Arguments
... |
arguments passed to other methods. |
model |
An |
treatment |
A character vector with the name of the treatment variable of the model. |
r2dz.x |
hypothetical partial R2 of unobserved confounder Z with treatment D, given covariates X. |
r2yz.dx |
hypothetical partial R2 of unobserved confounder Z with outcome Y, given covariates X and treatment D. |
reduce |
should the bias adjustment reduce or increase the
absolute value of the estimated coefficient? Default is |
estimate |
Coefficient estimate. |
se |
standard error of the coefficient estimate. |
dof |
residual degrees of freedom of the regression. |
message |
should messages be printed? Default = TRUE. |
which |
which limit of the confidence interval to show? Options are "both", lower limit ("lwr") or upper limit ("upr"). |
alpha |
significance level. |
h0 |
Null hypothesis for computation of the t-value. Default is zero. |
r.est |
restricted estimate. A numerical vector. |
est |
unrestricted estimate. A numerical vector. |
Value
Numeric vector with bias, adjusted estimate, standard error, or t-value.
References
Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).
Examples
# loads data
data("darfur")
# fits model
model <- lm(peacefactor ~ directlyharmed + age +
farmer_dar + herder_dar +
pastvoted + hhsize_darfur +
female + village, data = darfur)
# computes adjusted estimate for confounder with r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_estimate(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
# computes adjusted SE for confounder with r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_se(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
# computes adjusted t-value for confounder with r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_t(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
# Alternatively, pass in numerical values directly.
adjusted_estimate(estimate = 0.09731582, se = 0.02325654,
dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)
adjusted_se(estimate = 0.09731582, se = 0.02325654,
dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)
adjusted_t(estimate = 0.09731582, se = 0.02325654,
dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)