Skip to main content

State Space

State Space is a Python package that permits the symbolic specification of linear state space models with normally distributed innovations and measurement errors. Coefficients are defined via SymPy matrices which are then compiled into a numerical statsmodels implementation. These unobserved state is inferred via Kalman filtering and model parameters are estimated via maximum likelihood using statsmodels as the numerical backend.

Stochastic Process

A linear state space model consists of a state evolution equation and an observation equation. The state is not directly observed, instead a linear transformation of the state with added Gaussian noise is observed. In a linear state space model, the state evolves according to

State Transition Equation,

where the coefficients T, c, and R may depend on exogenous variables but not on the state itself. They may involve parameters that must be estimated from the data. The state innovation \eta_t has a multivariate normal distribution with zero mean and covariance matrix Q, which may depend on exogenous variables but not the state itself.

The observation equation maps the unobserved state according to

Observation Equation.

The observation noise \epsilon_t has a multivariate normal distribution with zero mean and covariance matrix H. The coefficients Z, d, as well as H may depend on exogeneous data and involve unknown parameters that are estimated via MLE.

State Space adopts the following terminology:
T: transition matrix
c: state intercept vector
R: selection matrix
Q: state covariance matrix
Z: design matrix
d: observation intercept
H: observation covariance matrix

The coefficients T,c, R, Q, Z, d, H are specified as SymPy matrices and may involve unknown parameters and exogenous data.

Examples

State Space includes two examples in Jupyter notebooks:
1.) A conditional linear factor model for returns of the Ford motor corporation with S&P 500 returns as the factor.
2.) A model of time-variation in the equity premium applied to S&P 500 index data.

Installation

    pip install state_space

or

    pip3 install state_space

if not using Anaconda.

Metadata

Release files for state-space 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for state-space 0.0.3
File Size Uploaded
state_space-0.0.3.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for state-space 0.0.3
File Interpreter ABI Platform
state_space-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / state_space-0.0.3.tar.gz

Download URL state_space-0.0.3.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4a5c49e65662d328a0247652f0c1028c61f72e93451618bbdff3d155056ff74a
BLAKE2b-256 checksum
How to use checksums
99f54a655bbb63b563b81be278822c1f19b69d02d7ecc310afda72cbc741e180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

Release files / state_space-0.0.3-py3-none-any.whl

Download URL state_space-0.0.3-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e585de451f750e93fe0da2e3295bf3f1a3cbc75154a51fa7e3f92365d20eae78
BLAKE2b-256 checksum
How to use checksums
ee37ee7ee401167c3534a6c46c5c74ce650c8f2a789eb0ee62574e6c74fbf550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page