Skip to contents

Estimates the effect of a period shock with onset onset on the cohorts observed in survey wave wave, one target age at a time, by extrapolating the cohort trend at that age from the H pre-shock waves. Respondents aged within b years of the target age are pooled; the survey wave is the running variable within the band. With order = 1 the extrapolant is the kernel- weighted local-linear fit (the default); with order = 0 it is the kernel-weighted mean of the pre-shock outcomes. Both are linear smoothers, and the function returns the quantities the theory needs: the effect, its plug-in standard error (treated-mean variance plus the variance of the extrapolated counterfactual), the bias factor bb (half the sum, over pre-shock surveys, of the absolute smoother weight times the squared distance of the survey from the target; a bound valid for any weights and the one used for the bias-aware interval), the exact worst-case factor of the local-linear fit bb_star (the same sum taken with signed weights, attained by a trend of constant curvature; bb_star <= bb), a rule-of-thumb curvature M from a global quadratic, the weighted mean cohort distance of the smoother weights (zero for order 1), and the sum of squared smoother weights.

Usage

cdd(
  data,
  outcome,
  onset,
  wave,
  H = 5,
  b = 5,
  ages = 20:70,
  order = 1L,
  kernel = "triangular",
  controls = NULL,
  reweight = NULL,
  balance = FALSE,
  continuous = FALSE,
  levels = NULL,
  permutation = FALSE,
  R = 2000,
  conf = 0.95,
  M = NULL,
  year = "year",
  age = "age",
  weight = "weight",
  multinomial = FALSE
)

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.

H

Number of pre-shock waves (the bandwidth in waves).

b

Age half-width; respondents aged a - b to a + b are pooled.

ages

Integer vector of target ages.

order

0 for the kernel-weighted mean, 1 for the local-linear extrapolant.

kernel

Kernel over wave rank, see cdd_kernel().

controls

Character vector of regression terms (e.g. c("factor(race)", "educ")) entering the extrapolation additively. NULL for none.

reweight

Character vector of terms for composition stabilization within cohorts (inverse-probability reweighting toward each cohort's pooled covariate distribution), applied to every cohort that enters an age band. Use time-invariant covariates only. NULL to skip.

balance

Logical; also reweight the comparison sample toward the treated sample's covariate distribution (controls) by inverse odds.

continuous

Logical; treat the outcome as continuous (single equation).

levels

Optional subset of outcome levels to estimate.

permutation

Logical; add a permutation test of the sharp null, conditional on the fitted trend, with R draws.

R

Number of permutation draws.

conf

Confidence level for intervals.

M

Optional curvature bound used for the bias-aware interval. If NULL the rule-of-thumb curvature estimated at each age is used.

year, age, weight

Names of the survey-year, age, and survey-weight columns.

multinomial

Logical; fit a multinomial logit extrapolation instead (check only: no smoother representation, so no se, bb, or intervals).

Value

A data frame of class cdd with one row per target age and outcome level, columns age, cohort, level, ate, se, lower, higher, bb, bb_star, curv, honest_lower, honest_higher, n1, n0, sum_l2, ubar, slope, sigma2, and when permutation = TRUE also p_perm, lower_perm, higher_perm. Settings are stored in attr(x, "settings").

References

Jiang, W., Mark, N., and Wu, L. L. (2026). The Cohort Discontinuity Design.

Examples

data(gss_culture)
fit <- cdd(gss_culture, "homosex", onset = 1992, wave = 1993, H = 5, b = 5,
           ages = c(25, 45, 65), controls = c("factor(race)", "factor(sex)", "educ"),
           reweight = c("factor(race)", "factor(sex)"))
fit[fit$level == "1", c("age", "ate", "se", "bb")]
#>  age     ate      se    bb
#>   25 -0.1343 0.05907 15.66
#>   45 -0.1482 0.05442 15.54
#>   65 -0.0353 0.06614 16.80