InteractiveFixedEffectsSyntheticControl#

class causalpy.experiments.interactive_fixed_effects.InteractiveFixedEffectsSyntheticControl[source]#

Interactive fixed-effects synthetic control on a WidePanel.

Not a SyntheticControl subclass. Several treated units share one treatment_time. Control units are donors. There is no n_factors argument: max_factors is an upper bound, not a selected rank.

build constructs the control-panel graph. Its likelihood uses the one shared positive residual scale, not a unit observation scale. fit samples the control-panel posterior of the shared factors, shared time intercepts, per-factor shrinkage scales, and that one scale. Treated pre-period outcomes may update the scale’s draws after that sample. They must not resample the factor or time-intercept draws. Loadings use the updated draws.

The untreated counterfactual is not a donor-row prediction. Raw factors and raw loadings are not identifiers: a rotation or a sign flip leaves the product unchanged. This sampler does not impose orthonormality.

Parameters:
  • data (DataFrame) – Balanced wide panel indexed by time. Used columns must have no missing values.

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

  • control_units (list[str] | tuple[str, ...]) – Donor columns.

  • treated_units (list[str] | tuple[str, ...]) – Treated columns. One or more.

  • max_factors (int) – Upper bound on the number of factors. Not a selected rank.

Methods

InteractiveFixedEffectsSyntheticControl.build()

Construct the control-panel graph without sampling.

InteractiveFixedEffectsSyntheticControl.compose_result(*, ...)

Compose the frozen result from component draws.

InteractiveFixedEffectsSyntheticControl.fit(*)

Sample the joint posterior and populate result.

InteractiveFixedEffectsSyntheticControl.plot(*)

Plot the reconstructed untreated trajectory and impact panels.

Attributes

control_units

Donor names, in the order supplied at construction.

treated_units

Treated names, in the order supplied at construction.

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

None

classmethod __new__(*args, **kwargs)#