Estimated risk and bandwidth selection for the two extrapolants
Source:R/bandwidth.R
cdd_bandwidth.RdFor each number of pre-shock waves H in grid and each polynomial order,
runs cdd() and evaluates the estimated mean squared error of the effect at
each target age. For the local-linear extrapolant (order 1) the bias term is
the squared worst-case bias over the curvature class, the square of M times the bias factor, so the
minimizer is the minimax-MSE window. For the kernel-weighted mean (order 0)
the leading bias is the slope of the cohort trend times the weighted mean distance of the window from the target,
which the smoothness class does not bound; it is therefore estimated
by plugging in a pilot slope, the slope at the target wave of the global
quadratic fitted to all pre-shock waves (the same fit that supplies M), and
the worst-case curvature remainder, M times the bias factor, is added. Taking the slope at the target
rather than over the window matters when the trend is curved, since the
window's average slope then understates the slope the kernel mean confronts. The variance is the plug-in
variance of the effect in both cases.
Usage
cdd_bandwidth(
data,
outcome,
onset,
wave,
grid = 3:8,
orders = c(0, 1),
M = NULL,
pilot_H = NULL,
...
)Arguments
- data
A data frame of repeated cross-sections.
- outcome
Name of the outcome column. Categorical outcomes are expanded into one linear probability equation per level unless
continuous = TRUE.- onset
Onset year of the shock. Pre-shock waves are those strictly before it.
- wave
The treated survey wave (year) whose respondents are the treated sample.
- grid
Integer vector of candidate
Hvalues.- orders
Which extrapolants to evaluate, a subset of
c(0, 1).- M
Curvature bound.
NULLuses the rule-of-thumb curvature estimated at each age (a global quadratic over all pre-shock waves), which does not depend onH.- pilot_H
The window of the pilot local-linear fit whose curvature estimate is used; defaults to
max(grid). (The pilot slope comes from the global quadratic and does not depend on it.)- ...
Further arguments passed to
cdd()(b,ages,kernel,controls,reweight,continuous,levels,year,age,weight).
Value
A list of class cdd_bandwidth with elements risk (one row per
H, order, level, and age with bias2, var, risk), summary
(risk averaged over ages, per H, order, level), and selected (per order
and level, the H minimizing average risk, and the order with the smaller
minimized risk flagged by best).