SCSPILLResults

utils.scspill_helpers.structures.SCSPILLResults()

Standardized results of the SCSPILL estimator.

Subclasses :class:scspill.config_models.BaseEstimatorResults, so the flat effect surface (att, att_ci, counterfactual, gap, donor_weights, pre_rmse, .plot()) resolves through the shared contract, while the Bayesian detail lives in typed fields:

  • :attr:inputs – the prepared panel and spatial weights;
  • :attr:alpha_posterior / :attr:sar_posterior – the two posterior blocks with their full draw arrays;
  • :attr:effects_detail – ATT draws, counterfactual band, and the per-donor spillover panel;
  • :attr:scm_weights – classical simplex-SCM comparator weights.

:attr:method records which spillover model produced the fit. It mirrors SCSPILLConfig.method and the suffix of method_details.method_name ("SCSPILL/<method>"). Only "sar" exists today; a model added later declares its own posterior blocks alongside :attr:alpha_posterior / :attr:sar_posterior, which are SAR-specific, while :attr:inputs, :attr:effects_detail and the flat effect surface are the cross-model contract.

Attributes

Name Description
acc_rho Post-burn acceptance rate of the rho Metropolis step.
alpha_draws Step-1 alpha draws, shape (M, N).
alpha_hat Posterior mean of the synthetic weights alpha.
rho_ci Equal-tailed credible interval for rho at the fit’s ci level.
rho_draws Step-2 rho draws, shape (M,).
rho_ess Effective sample size of the rho chain.
rho_hat Posterior mean of the spillover intensity rho.
spillover_lower Pointwise lower credible band of the spillover effects.
spillover_panel Posterior-mean spillover effects, (T, N) time-by-donor.
spillover_upper Pointwise upper credible band of the spillover effects.

Methods

Name Description
diagnostics Posterior summary and convergence diagnostics table.
plot Plot the fitted result.

diagnostics

utils.scspill_helpers.structures.SCSPILLResults.diagnostics(
    which_alpha=None,
    top_n_alpha=6,
    which_beta=None,
    top_n_beta=6,
)

Posterior summary and convergence diagnostics table.

Builds one row per monitored chain (rho, sigma2, selected alpha components, and covariate coefficients when present) with posterior mean, sd, quantiles, effective sample size, split-chain R-hat, Monte Carlo standard error, and a Geweke z-score – mirroring the R package’s diagnostics() summary.

Parameters

Name Type Description Default
which_alpha list Donor labels whose alpha chains to include. Defaults to the top_n_alpha donors by absolute posterior-mean weight. None
top_n_alpha int Number of top-|alpha| donors monitored when which_alpha is None. 6
which_beta list Covariate names whose beta chains to include. Defaults to the first top_n_beta covariates. None
top_n_beta int Number of covariates monitored when which_beta is None. 6

Returns

Name Type Description
pd.DataFrame One row per parameter with columns mean, sd, q025, q50, q975, ess, rhat_split, mcse, geweke_z.

plot

utils.scspill_helpers.structures.SCSPILLResults.plot(
    kind='auto',
    *,
    ax=None,
    **overrides,
)

Plot the fitted result.

Parameters

Name Type Description Default
kind str "auto" / "counterfactual" / "gap" use the shared effect-plot contract; "panel", "full", "effect", "spill_top", "weights", "rho", and "trace" route to :func:scspill.utils.scspill_helpers.plotter.plot_scspill. "auto"
ax matplotlib Axes Draw into an existing axis (single-panel kinds only). None
**overrides Any Cosmetic overrides forwarded to the plotting layer. {}

Returns

Name Type Description
matplotlib.axes.Axes or np.ndarray of Axes