| Version: | 0.2.0 |
| Title: | Flexible Tools for Estimating Interactions |
| Imports: | stats, fixest, glmnet |
| Depends: | R (≥ 3.0.0) |
| Suggests: | knitr, ggplot2, lmtest, rmarkdown |
| Description: | A set of functions to estimate interactions flexibly in the face of possibly many controls. Implements the procedures described in Blackwell and Olson (2022) <doi:10.1017/pan.2021.19>. |
| License: | GPL-2 |GPL-3 [expanded from: GPL (≥ 2)] |
| URL: | https://mattblackwell.github.io/inters/ |
| BugReports: | https://github.com/mattblackwell/inters/issues |
| VignetteBuilder: | knitr |
| LazyData: | true |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.1 |
| NeedsCompilation: | no |
| Packaged: | 2023-01-10 19:22:14 UTC; mblackwell |
| Author: | Matthew Blackwell |
| Maintainer: | Matthew Blackwell <mblackwell@gov.harvard.edu> |
| Repository: | CRAN |
| Date/Publication: | 2023-01-10 20:10:02 UTC |
Post-double selection estimator for interactions
Description
post_ds_interaction applies post-double selection to theestimation of an interaction in a linear model.
Usage
post_ds_interaction( data, treat, moderator, outcome, control_vars, panel_vars = NULL, moderator_marg = TRUE, cluster = NULL, method = "double selection")Arguments
data | data.frame to find the relevant variables. |
treat | string with the name of the treatment variable. |
moderator | string with the name of the moderating variable. |
outcome | string with the name of the outcome variable. |
control_vars | vector of strings with the names of thecontrol variables to include. |
panel_vars | vector of strings with the names of categoricalvariables to include as fixed effects. |
moderator_marg | logical indicating if the lower-order termof the moderator should be included () |
cluster | string with the name of the cluster variable. |
method | string indicating which method to use. The defaultis |
Details
Thepost_ds_interaction implements the post-doubleselection estimator of Belloni et al (2014) as applied tointeractions, which was proposed by Blackwell and Olson (2019).Variables passed topanel_vars are considered factorsfor fixed effects and whose "base effects" are removed bydemeaning all variables by those factors. Interactions betweenthe moderator and all variables (including the factors generatedbypanel_vars) are generated and passed to thepost-double selection procedure. Base terms for the treatment,moderator, and control variables are forced to be included inthe final post-double selection OLS. Thecluster argumentadjusts the lasso
Value
Returns an object of the classlm with anadditionalclustervcv object containing thecluster-robust variance matrix estimate whencluster isprovided.
References
Alexandre Belloni, Victor Chernozhukov, ChristianHansen, Inference on Treatment Effects after Selection amongHigh-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 Misspectationand Bias in the Estimation of Interactions." Political Analysis,2021.
Examples
data(remit)controls <- c("l1gdp", "l1pop", "l1nbr5", "l12gr", "l1migr","elec3")post_ds_out <- post_ds_interaction( data = remit, treat = "remit", moderator = "dict", outcome = "Protest", control_vars = controls, cluster = "caseid")Data on the direct primary in US congressional elections
Description
A data set on the presence of the direct primary in U.S.congressional elections and the vote shares for the Democratic,Republican, and third parties. Based on ICPSR Study 6985
Usage
primaryFormat
A data frame with 1164 observations and the following 7variables:
- state
name of the state
- year
year of the congressional election
- dem_share
percentage of the total vote cast for theDemocratic candidate, 0-100
- rep_share
percentage of the total vote cast for theRepublican candidate, 0-100
- other_share
percentage of the total vote cast for otherparties, 0-100
- primary
binary variable indicating if the state had thedirect primary (=1) or not (=0)
- south
binary variable indicating if the state is in theSouth (=1) or not (=0)
Source
https://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/6895
References
David, Paul T., and Claggett, William. Party Strengthin the United States: 1872-1996. Ann Arbor, MI: Inter-universityConsortium for Political and Social Research [distributor],2008-09-10. https://doi.org/10.3886/ICPSR06895.v1
Cross-national data on remittances and protest
Description
A data set to replicate the findings of Escrib\'a-Folch,Meseguer, and Wright (2018). Data and data descriptions arefrom that paper's replication data, available atdoi:10.7910/DVN/TVZQG6
Usage
remitFormat
A data frame with 2429 observations and 14 variables:
- Protest
standardized measure of latent protest from Chenoweth et al. (2014)
- remit
natural log of the 2-year lagged moving average of total remittances received in constant US dollars
- dict
binary indicator of autocracy or democracy fromGeddes, Wright, and Frantz (2014)
- l1gdp
natural log of one-period lagged gdp per capita
- l1pop
natural log of one-period lag of population
- l1nbr5
lagged mean latent level of protest in countries with capital cities within 4000km of the target country's capital
- l12gr
two-year lagged moving average of GDP per capita growth (in percent)
- l1migr
natural log of lagged net migration in millions
- elec3
indicator for multiparty election in that year, year prior, or year after
- cowcode
country code from correlates of war dataset
- period
six ordinal time periods
- caseid
numerical code for autocratic regime case name
- year
year
Source
References
Escrib\'a-Folch, A., Meseguer, C. and Wright, J. (2018), Remittances and Protest in Dictatorships. American Journal of Political Science, 62: 889-904.doi:10.1111/ajps.12382
Wright, Joseph, 2018, "Replication Data for: Remittances and Protest in Dictatorships",doi:10.7910/DVN/TVZQG6, Harvard Dataverse, V1, UNF:6:IE6OqUb3EB5AIDYKI28mgA== [fileUNF]