Skip to contents

For 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 H values.

orders

Which extrapolants to evaluate, a subset of c(0, 1).

M

Curvature bound. NULL uses the rule-of-thumb curvature estimated at each age (a global quadratic over all pre-shock waves), which does not depend on H.

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).

Examples

data(gss_culture)
bw <- cdd_bandwidth(gss_culture, "homosex", onset = 1992, wave = 1993,
                    grid = 3:6, ages = c(30, 50), b = 5, levels = 1)
bw$selected
#>   H order level        bias2         var        risk  best
#> 1 3     0     1 0.0009639951 0.001788093 0.002752088  TRUE
#> 2 6     1     1 0.0002230689 0.002703161 0.002926230 FALSE