Description Usage Arguments Value Examples
Computes tethered and constraint-based hacking intervals of the coefficient of a binary treatment variable in a linear model. See https://github.com/beauCoker/hacking for examples.
1 2 | hackint_lm(mdl, data, treatment, theta = 0.1, frac_remove_obs = 1,
verbose = TRUE)
|
mdl |
|
data |
|
treatment |
name of binary treatment variable (inputted as |
theta |
loss tolerance for tethered hacking (default = 0.1) |
frac_remove_obs |
fraction of observations to consider for removal (default = 1, meaning all observations considered) |
verbose |
whether or not to print summary |
list
containing all hacking intervals (tethered
, constrained
, tethered_and_constrained
)
as well as complete list of all manipulations applied to the base model (hacks_all
)
1 2 3 4 5 6 7 8 9 | N = 50 # Number of observations
data <- data.frame(
y = rnorm(N), # Response variable (continuous)
w = rbinom(N, 1, .5), # Treatment variable (binary)
X = matrix(rnorm(N*3), nrow=N), # Covariates included in base model
Z = matrix(rnorm(N*3), nrow=N) # Covariates excluded from base model
)
mdl <- lm(y ~ w + X.1*X.2, data=data) # fit linear "base" model
output <- hackint_lm(mdl, data, theta=0.1, treatment = 'w')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.