Python API#

The package ssfortran calls the Fortran library through its C interface (C interface). Arrays are numpy arrays with time as the last axis, as in statsmodels; periods passed as arguments are 0-based.

Representation#

Representation(endog, k_states[, k_posdef])

A linear Gaussian state space model and its algorithms.

FilterResults(llf, llf_obs, nobs_diffuse, ...)

Output of the Kalman filter (DK §4.3, §5.2).

SmootherResults(filter, smoothed_state, ...)

Output of the state and disturbance smoother (DK §4.4-4.5, §5.3).

AugmentedResults(filter, delta, delta_cov, ...)

Output of the augmented Kalman filter and smoother (DK §5.7).

Models and estimation#

StructuralModel(endog, components[, ...])

A model assembled from structural components (DK ch.

MappedModel(endog[, k_states, k_params, ...])

A model declared by the matrix entries each parameter sets.

MLEModel(endog, k_states, k_params[, k_posdef])

A model whose system matrices are set by Python code.

Model()

Base class of models with parameters, held by the Fortran library.

FitResults(model, params, param_names, bse, ...)

Maximum likelihood estimates and the fitted model (DK §7.3).

ForecastResults(predicted_mean, var_pred_mean)

Forecasts past the end of the sample (DK §4.11).

fit_many(models[, maxiter, m, factr, pgtol, ...])

Fit independent models in parallel.

Components#

Irregular([cov, weights])

Observation disturbance \(\varepsilon_t \sim N(0, \Sigma_\varepsilon)\).

Level([cov, at_observations])

Random walk level \(\mu_{t+1} = \mu_t + \xi_t\) (DK ch.

Trend([level_cov, slope_cov, at_observations])

Local linear trend (DK §3.2.1).

Seasonal(period[, form, cov, at_observations])

Seasonal component of a given period (DK §3.2.2).

Cycle([cov, damped, period_bounds, ...])

Stochastic cycle (DK §3.2.4).

Regression(exog[, random_walk, series, ...])

Regression effects \(x_t' \beta_t\) (DK §3.2.5, §3.6).

ARIMA([order, seasonal_order, series, ...])

ARIMA(p, d, q)(P, D, Q)_s component (DK §3.4).

ContinuousLevel(times[, at_observations])

Level in continuous time observed at arbitrary times (DK §3.8.1).

ContinuousTrend(times[, at_observations])

Smooth trend in continuous time observed at arbitrary times (DK §3.8.2).

Diagnostics#

diagnostics.ljung_box(x[, lags, model_df])

Test for serial correlation with the Ljung-Box statistic.

diagnostics.jarque_bera(x)

Test for normality with the Jarque-Bera statistic.

diagnostics.breakvar(x[, h])

Test for heteroskedasticity by comparing the two ends of the sample.

Errors and constants#

StateSpaceError(code, where)

An error reported by the Fortran library.

version()

Return the version of the Fortran library.

The initialization kinds INIT_KNOWN, INIT_APPROX_DIFFUSE, INIT_STATIONARY, INIT_DIFFUSE and INIT_GENERAL are passed to Representation.initialize_block(); FILTER_CONVENTIONAL, FILTER_UNIVARIATE, DIFFUSE_UNIVARIATE and DIFFUSE_MULTIVARIATE are values of the filter_method and diffuse_method options.

ssfortran.INIT_KNOWN#
ssfortran.INIT_APPROX_DIFFUSE#
ssfortran.INIT_STATIONARY#
ssfortran.INIT_DIFFUSE#
ssfortran.INIT_GENERAL#
ssfortran.FILTER_CONVENTIONAL#
ssfortran.FILTER_UNIVARIATE#
ssfortran.DIFFUSE_UNIVARIATE#
ssfortran.DIFFUSE_MULTIVARIATE#