| pred | R Documentation |
Creates a single predictor specification for use in scm_fit() with
method = "scm". Pass a list() of pred() calls as the predictors
argument to define the full covariate matrix.
pred(vars, times, op = "mean")
vars |
Character vector of variable names. All variables share the
same |
times |
Numeric/integer vector of time values to aggregate over.
Values are matched against the time index of the panel passed to
|
op |
Aggregation operator applied to each variable over |
A pred_spec object (a named list with class "pred_spec").
scm_fit() for the predictors argument that consumes a list()
of pred_spec objects.
# Three variables averaged over the same window
pred(c("lnincome", "retprice", "age15to24"), 1980:1988)
# Single variable at a specific year
pred("cigsale", 1975)
# Single variable averaged over a range
pred("beer", 1984:1988)
# Abadie, Diamond & Hainmueller (2010) California Prop 99 style: combine
# several covariates aggregated over different windows plus three outcome
# lags at specific years. The resulting list is passed to
# scm_fit(..., predictors = predictors).
predictors <- list(
pred(c("lnincome", "retprice", "age15to24"), 1980:1988),
pred("beer", 1984:1988),
pred("cigsale", 1988),
pred("cigsale", 1980),
pred("cigsale", 1975)
)
predictors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.