ssfortran.FitResults#
- class ssfortran.FitResults(model, params, param_names, bse, cov_params, llf, scale, aic, bic, niter, nfev, converged, analytic_gradient, message)#
Maximum likelihood estimates and the fitted model (DK §7.3).
- Attributes:
- modelModel
The model that was fitted.
- paramsndarray, shape (k,)
Estimates, constrained.
- param_nameslist of str
Parameter names.
- bsendarray, shape (k,)
Standard errors; NaN if the Hessian was not negative definite.
- cov_paramsndarray, shape (k, k)
Covariance of the estimates: the inverse of the negative Hessian in the unconstrained parameters, mapped to the constrained ones by the delta method (DK §7.3.6).
- llffloat
Maximized log likelihood.
- scalefloat
Estimated scale when it is concentrated out, else 1.
- aic, bicfloat
Information criteria, counting the diffuse states and a concentrated scale as parameters (DK §7.4, not divided by n).
- niter, nfevint
Optimizer iterations and log likelihood evaluations.
- convergedbool
Whether L-BFGS-B met its convergence criterion.
- analytic_gradientbool
Whether the analytic score was used for at least one parameter.
- messagestr
The optimizer’s final message.
- components(variance=False)#
Compute the smoothed components at the estimates.
- Parameters:
- variancebool, optional
Also return their variances.
- Returns:
- dict or tuple of dict
See
Model.components().
- diagnostics(lags=None)#
Test the standardized residuals (DK §2.12, §7.5).
Uses the first series, after the diffuse periods.
- Parameters:
- lagsint, optional
Lags of the Ljung-Box test; default min(10, n/5).
- Returns:
- dict
ljung_box: (lags, Q, p-value);jarque_bera: (statistic, p-value);skew,kurtosis;heteroskedasticity: (H, p-value).
- estimation_bias(ndraw=1000, antithetic=True, seed=None, variance=False)#
Estimate the bias in the smoothed state from estimating the parameters.
DK §7.3.7, eq. 7.20: treating \(\hat\psi\) as the true value, draw \(\psi^{(i)}\) from \(N(\hat\psi, \Omega)\) on the unconstrained scale and average \(\hat\alpha(\psi^{(i)}) - \hat\alpha(\hat\psi)\).
- Parameters:
- ndrawint, optional
Number of draws; even when antithetic.
- antitheticbool, optional
Pair each draw with its reflection about \(\hat\psi\).
- seedint, optional
Seed of the library’s random numbers, for reproducible results.
- variancebool, optional
Also return the bias in the smoothed state variance.
- Returns:
- bias_alphandarray, shape (m, n)
Bias in the smoothed state.
- bias_Vndarray, shape (m, m, n)
Bias in its variance; only with
variance=True.
- Raises:
- ValueError
If cov_params is not available.
- filter()#
Run the filter at the estimates.
- Returns:
- FilterResults
The filter output.
- property fittedvalues#
One-step predictions of y, shape (n,) or (n, p).
- forecast(steps)#
Forecast past the end of the sample.
- Parameters:
- stepsint
Number of periods ahead.
- Returns:
- ndarray
get_forecast(steps).predicted_mean.
- get_forecast(steps)#
Forecast past the end of the sample (DK §4.11).
- Parameters:
- stepsint
Number of periods ahead.
- Returns:
- ForecastResults
Forecasts and their variances.
- Raises:
- StateSpaceError
With code 4 for models with time-varying system matrices.
- property resid#
One-step prediction errors \(v_t\), shape (n,) or (n, p).
- smooth()#
Run the filter and smoother at the estimates.
- Returns:
- SmootherResults
Smoothed states and disturbances.
- property standardized_residuals#
Standardized prediction errors (DK §7.5); NaN where missing or diffuse.
- summary(alpha=0.05)#
Summarize the estimates, the fit and the residual tests.
- Parameters:
- alphafloat, optional
One minus the coverage of the confidence intervals.
- Returns:
- str
A table of estimates with standard errors, z statistics, p-values and confidence intervals; the log likelihood, AIC, BIC and number of diffuse periods; and the tests of
diagnostics().