Run sensitivity analysis on post-measurement design
Usage
post_sens(
formula,
data,
moderator,
g_by,
g_max = 1,
q_by,
sims = 1000,
conf_level = 0.95,
moderator_mono = NULL,
stable_mod = FALSE,
progress = TRUE,
solver = "Rglpk"
)
Arguments
- formula
A formula with syntax
y ~ t
, wherey
is the (unquoted) name of the outcome andt
is the (unquoted) name of the treatment.- data
A data.frame containing variables in the formula, moderator, and covariates arguments.
- moderator
A one-sided formuala with syntax
~ d
, whered
is the (unquoted) name of the moderator variable for the CATE.- g_by
Numeric indicating the grid spacing for the \(\gamma\) parameter that places an upper bound on the proportion of units whose moderator is affected by treatment.
- g_max
Numeric indicating the maximum value of the \(\gamma\) parameter.
- q_by
Numeric indicating the grid spacing for the mean of the moderator under a pre-test measurement.
- sims
An integer indicating the number of simulations for the bootstrap confidence intervals for the bounds.
- conf_level
A numeric indicating the confidence level for the bootstrap confidence intervals.
- moderator_mono
A integer or vector of length 2 indicating if the bounds should assume monotonicity of the effect of the post-test on the moderator with
1
indicating that the post-test effect is positive and-1
indicating that it is negative. The vector of length 2 allows the monotonicity assumption to vary by treatment status with the first entry being for control and the second for treated.- stable_mod
A logical value indicating if the bounds should assume that the moderator is unaffected by pre-vs-post measurement under the control condition.
- progress
A logical indicating if progress bars should be displayed. Defaults to TRUE.
- solver
A character indicating what linear programming solver to use: "Rglpk" (the default) or "lpSolve".
Examples
data(delponte)
post_sens(formula = angry_bin ~ t_commonality,
data = delponte,
moderator = ~ itaid_bin,
g_by = 0.1,
sims = 50
)
#> 0% |== | 100%
#> 0% |==== | 100%
#> 0% |====== | 100%
#> 0% |======== | 100%
#> 0% |========== | 100%
#> 0% |============ | 100%
#> 0% |============== | 100%
#> 0% |================ | 100%
#> 0% |================== | 100%
#> 0% |====================| 100%
#> gamma lower upper ci_lower ci_upper
#> 1 0.0615942 -1.015053 0.1817998 -1.076013 0.9159451
#> 2 0.1615942 -1.015053 0.7984021 -1.099627 1.1495981
#> 3 0.2615942 -1.278600 0.8184618 -1.605928 0.9823337
#> 4 0.3615942 -1.399967 0.9215294 -1.701747 1.0131734
#> 5 0.4615942 -1.112325 1.0542587 -1.200810 1.1526079
#> 6 0.5615942 -1.147707 1.1477073 -1.197402 1.1964693
#> 7 0.6615942 -1.147707 1.1477073 -1.196555 1.1965553
#> 8 0.7615942 -1.147707 1.1477073 -1.196555 1.1965553
#> 9 0.8615942 -1.147707 1.1477073 -1.196555 1.1965553
#> 10 0.9615942 -1.147707 1.1477073 -1.196555 1.1965553