cd.structures.CDFit

utils.scspill_helpers.cd.structures.CDFit(
    inputs,
    intercepts,
    scm_matrix,
    gamma,
    effects_panel,
    pre_residuals,
    placebo_effects,
    pointwise_p_values,
    pointwise_ci,
    published_ci,
    kappa_test,
    rank,
    condition_number,
    scm_paths,
    att_by_unit,
    att_scm_by_unit,
    reference_mode,
    quantile_method,
    ci_method,
    ci_level,
    weighting='identity',
    efficient=None,
    sensitivity=None,
)

Everything the cd pipeline produced.

Attributes

Name Type Description
inputs CDInputs The prepared panel and exposure matrix.
intercepts pd.Series Intercept a_i of every unit’s SCM equation.
scm_matrix pd.DataFrame The all-unit SCM weight matrix B; row i is unit i’s simplex weights on the other units.
gamma pd.DataFrame Estimated effect parameters, post periods by columns of A.
effects_panel pd.DataFrame Estimated effect on every unit, alpha_t = A gamma_t: post periods by unit labels. The treated columns are the direct effects; the control columns are the spillovers.
pre_residuals pd.DataFrame Pre-treatment SCM residuals (I - B) Y_t - a, periods by units.
placebo_effects pd.DataFrame Pre-treatment placebo effects G u_t used as P-test references, periods by units.
pointwise_p_values pd.DataFrame P value of alpha_{i,t} = 0, post periods by units.
pointwise_ci, published_ci dict {unit: DataFrame(lower, upper)} intervals by test inversion and by the authors’ signed-quantile rule.
kappa_test dict {post period: CDTestResult} of the kappa_A structure test.
rank, condition_number (int, float) Rank of (I - B) A and condition number of A'(I-B)'(I-B)A.
scm_paths pd.DataFrame Each treated unit’s no-spillover synthetic control a_i + B_i Y_t, all periods by treated labels.
att_by_unit, att_scm_by_unit dict Average post-treatment direct effect of every treated unit, and the same from its no-spillover synthetic control.
reference_mode, quantile_method, ci_method str The inference settings.
ci_level float Level of every interval and test.
weighting str "identity", or "efficient" when :attr:efficient is set.
efficient CDEfficientFit or None The efficient estimator (weighting="efficient").
sensitivity PureDonorSensitivity or None Bias weights under missed spillovers; None without clean controls.

Methods

Name Description
test_hypothesis Test C @ alpha_t = d by the pre-treatment P distribution.

test_hypothesis

utils.scspill_helpers.cd.structures.CDFit.test_hypothesis(
    C,
    *,
    d=None,
    period=None,
    weight=None,
    quantile_method=None,
)

Test C @ alpha_t = d by the pre-treatment P distribution.

Parameters

Name Type Description Default
C array or DataFrame Contrast matrix with one column per unit in unit_labels order, or labeled columns when passed as a DataFrame. For example np.eye(n)[1:] tests “no spillover on any control” when there is one treated unit. required
d array or float Null value, zero by default. None
period optional A post-treatment period label; the first one by default. None
weight array or 'inverse_covariance' Weighting matrix of the quadratic statistic: the identity by default, an explicit positive-definite matrix, or the inverse second moment of the projected placebo effects. None
quantile_method ('empirical', 'linear') Overrides the fit’s critical-value rule. "empirical"

Returns

Name Type Description
CDTestResult