cv_pensynth: Hold-out validated penalized synthetic control estimator

View source: R/cv_pensynth.R

cv_pensynthR Documentation

Hold-out validated penalized synthetic control estimator

Description

Compute a penalized synthetic control estimator with hold-out validation for the lambda penalty parameter. Lambda will be determined by minimizing the mean squared error on a hold-out set of pre-intervention outcome time-series.

Usage

cv_pensynth(
  X1,
  X0,
  Z1,
  Z0,
  v = 1,
  nlambda = 100,
  opt_pars = clarabel::clarabel_control(),
  standardize = TRUE,
  return_solver_info = FALSE,
  verbose = interactive(),
  adaptive_lambda = TRUE
)

Arguments

X1

⁠N_covars by N_treated matrix⁠ of treated unit covariates

X0

⁠N_covars by N_donors matrix⁠ of donor unit covariates

Z1

⁠N_targets by N_treated matrix⁠ of treated unit hold-out outcome(s)

Z0

⁠N_targets by N_donors matrix⁠ of donor unit hold-out outcomes

v

⁠N_covars vector⁠ of variable weights, default 1

nlambda

integer length of lambda sequence (see details)

opt_pars

clarabel settings using clarabel::clarabel_control()

standardize

boolean whether to standardize the input matrices (default TRUE)

return_solver_info

boolean whether to return diagnostic information concerning solver (default FALSE)

verbose

boolean whether to print progress messages. Default on if in an interactive session.

adaptive_lambda

booleanwhether to allow the selected lambda to differ across treated units (default TRUE)

Details

The lambda sequence is an exponentially increasing sequence where The minimum lambda is always 1e-11, the max lambda is determined by the data.

For multiple treated units, is adaptive_lambda is set to FALSE, the (shared) minimum lambda will be selected by local regression of sqrt(mse) on log(lambda).

Value

A list of optimal weights, optimal lambda(s), the lambda sequence(s), the associated weights, and the mses. If there are multiple treated units, this list contains sublists for each unit. If return_solver_info is TRUE, the list will also contain diagnostic information about the solvers.

See Also

pensynth(), plot.cvpensynth(), placebo_test(), simulate_data_synth()

Examples

set.seed(45)
dat <- simulate_data_synth()
res <- with(dat, cv_pensynth(X1, X0, Z1, Z0))
plot(res)

pensynth documentation built on May 7, 2026, 9:06 a.m.