StateSpaceTimeSeries.score#

StateSpaceTimeSeries.score(X=None, y=None, coords=None)[source]#

Score the Bayesian R^2 given inputs X and outputs y.

In-sample predictions come from the Kalman smoother, which conditions on the observed y, so this R^2 reads higher than for models that predict from covariates alone. Compare scores only within state-space models.

Parameters:
  • X (DataArray | None) – Input features. In-sample predictions come from the Kalman smoother, so X is not used here.

  • y (DataArray | None) – Target variable with dims [“obs_ind”, “treated_units”].

  • coords (dict[str, Any] | None) – Not used, kept for API compatibility.

Returns:

R² score and standard deviation for each treated unit.

Return type:

pd.Series