R/lasso_interactions.R
post_ds_interaction.Rd
post_ds_interaction
applies post-double selection to the
estimation of an interaction in a linear model.
post_ds_interaction(
data,
treat,
moderator,
outcome,
control_vars,
panel_vars = NULL,
moderator_marg = TRUE,
cluster = NULL,
method = "double selection"
)
data.frame to find the relevant variables.
string with the name of the treatment variable.
string with the name of the moderating variable.
string with the name of the outcome variable.
vector of strings with the names of the control variables to include.
vector of strings with the names of categorical variables to include as fixed effects.
logical indicating if the lower-order term of the moderator should be included ()
string with the name of the cluster variable.
string indicating which method to use. The default
is "double selection"
selects variables based on the
outcome and treatment/interaction variables and "single
selection"
only selects on the outcome.
Returns an object of the class lm
with an
additional clustervcv
object containing the
cluster-robust variance matrix estimate when cluster
is
provided.
The post_ds_interaction
implements the post-double
selection estimator of Belloni et al (2014) as applied to
interactions, which was proposed by Blackwell and Olson (2019).
Variables passed to panel_vars
are considered factors
for fixed effects and whose "base effects" are removed by
demeaning all variables by those factors. Interactions between
the moderator and all variables (including the factors generated
by panel_vars
) are generated and passed to the
post-double selection procedure. Base terms for the treatment,
moderator, and control variables are forced to be included in
the final post-double selection OLS. The cluster
argument
adjusts the lasso
Alexandre Belloni, Victor Chernozhukov, Christian Hansen, Inference on Treatment Effects after Selection among High-Dimensional Controls, The Review of Economic Studies, Volume 81, Issue 2, April 2014, Pages 608-650, doi:10.1093/restud/rdt044
Matthew Blackwell and Michael Olson.. "Reducing Model Misspectation and Bias in the Estimation of Interactions." Political Analysis, 2021.