AugmentedSyntheticControl#

class causalpy.experiments.augmented_synthetic_control.AugmentedSyntheticControl[source]#

Sample a joint augmented synthetic control posterior.

One PyMC model draws simplex base weights and one shared donor prognostic correction. Credible intervals of the counterfactual and the treatment effect are Bayesian intervals for that full model, not a cut posterior.

Weights are independent across treated units. Each unit’s weights are Dirichlet with concentration ones, with a Normal likelihood on that unit’s pre-period outcomes and mean equal to the donor pre-period matrix times the unit’s weights. The prognostic regression uses donor outcomes at each time as the response and that donor’s full pre-period outcome vector as covariates, with time-specific coefficients and no intercept. Coefficients have a Normal(0, tau) prior and tau is HalfNormal with scale 1. Both Normal likelihoods use observation scale 1. All units share one treatment_time.

Parameters:
  • data (DataFrameLike) – Wide outcome panel. The time axis is the index, or time_column.

  • treatment_time (int | float | Timestamp) – First post-period time. Rows at this time are post-period.

  • control_units (Sequence[str]) – Donor column names.

  • treated_units (Sequence[str]) – Treated column names.

  • time_column (str | None) – Column to use as the time axis when data has no index.

Raises:
  • DataException – If the time axis cannot be taken from data.

  • BadIndexException – If treatment_time cannot be compared with the time axis.

  • ValueError – If the unit columns, the pre-period, or the post-period cannot support the recorded likelihoods.

Notes

The untreated counterfactual at post-period time t for treated unit u is donor_post[t] @ w_u + (X_u - X_donors @ w_u) @ beta[t]. X_u and each donor row of X_donors are full pre-period outcome vectors. beta[t] is the prognostic coefficient vector at time t. The treatment effect is the treated post-period outcome minus that counterfactual. Treated post-period outcomes do not enter the counterfactual or either likelihood.

Methods

AugmentedSyntheticControl.fit([sample_kwargs])

Sample the joint posterior.

__init__(data, treatment_time, control_units, treated_units, *, time_column=None)[source]#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#