statsmodels.tsa.statespace.representation.Representation¶
- class statsmodels.tsa.statespace.representation.Representation(k_endog, k_states, k_posdef=None, initial_variance=1000000.0, nobs=0, dtype=<class 'numpy.float64'>, design=None, obs_intercept=None, obs_cov=None, transition=None, state_intercept=None, selection=None, state_cov=None, statespace_classes=None, **kwargs)[source]¶
State space representation of a time series process
- Parameters:¶
- k_endog{array_like,
int
} The observed time-series process
if array like or the number of variables in the process if an integer.- k_states
int
The dimension of the unobserved state process.
- k_posdef
int
,optional
The dimension of a guaranteed positive definite covariance matrix describing the shocks in the measurement equation. Must be less than or equal to k_states. Default is k_states.
- initial_variance
float
,optional
Initial variance used when approximate diffuse initialization is specified. Default is 1e6.
- initialization
Initialization
object
orstr
,optional
Initialization method for the initial state. If a string, must be one of {‘diffuse’, ‘approximate_diffuse’, ‘stationary’, ‘known’}.
- initial_statearray_like,
optional
If initialization=’known’ is used, the mean of the initial state’s distribution.
- initial_state_covarray_like,
optional
If initialization=’known’ is used, the covariance matrix of the initial state’s distribution.
- nobs
int
,optional
If an endogenous vector is not given (i.e. k_endog is an integer), the number of observations can optionally be specified. If not specified, they will be set to zero until data is bound to the model.
- dtype
np.dtype
,optional
If an endogenous vector is not given (i.e. k_endog is an integer), the default datatype of the state space matrices can optionally be specified. Default is np.float64.
- designarray_like,
optional
The design matrix,
. Default is set to zeros.- obs_interceptarray_like,
optional
The intercept for the observation equation,
. Default is set to zeros.- obs_covarray_like,
optional
The covariance matrix for the observation equation
. Default is set to zeros.- transitionarray_like,
optional
The transition matrix,
. Default is set to zeros.- state_interceptarray_like,
optional
The intercept for the transition equation,
. Default is set to zeros.- selectionarray_like,
optional
The selection matrix,
. Default is set to zeros.- state_covarray_like,
optional
The covariance matrix for the state equation
. Default is set to zeros.- **kwargs
Additional keyword arguments. Not used directly. It is present to improve compatibility with subclasses, so that they can use **kwargs to specify any default state space matrices (e.g. design) without having to clean out any other keyword arguments they might have been passed.
- k_endog{array_like,
- Attributes:¶
- nobs
int
The number of observations.
- k_endog
int
The dimension of the observation series.
- k_states
int
The dimension of the unobserved state process.
- k_posdef
int
The dimension of a guaranteed positive definite covariance matrix describing the shocks in the measurement equation.
- shapes
dictionary
of
name:tuple A dictionary recording the initial shapes of each of the representation matrices as tuples.
- initialization
str
Kalman filter initialization method. Default is unset.
- initial_variance
float
Initial variance for approximate diffuse initialization. Default is 1e6.
- nobs
Notes
A general state space model is of the form
where
refers to the observation vector at time , refers to the (unobserved) state vector at time , and where the irregular components are defined asThe remaining variables (
) in the equations are matrices describing the process. Their variable names and dimensions are as followsZ : design
d : obs_intercept
H : obs_cov
T : transition
c : state_intercept
R : selection
Q : state_cov
In the case that one of the matrices is time-invariant (so that, for example,
), its last dimension may be of size rather than size nobs.References
Methods
bind
(endog)Bind data to the statespace representation
clone
(endog, **kwargs)Clone a state space representation while overriding some elements
diff_endog
(new_endog[, tolerance])extend
(endog[, start, end])Extend the current state space model, or a specific (time) subset
initialize
(initialization[, ...])Create an Initialization object if necessary
initialize_approximate_diffuse
([variance])Initialize the statespace model with approximate diffuse values.
initialize_components
([a, Pstar, Pinf, A, ...])Initialize the statespace model with component matrices
Initialize the statespace model as diffuse.
initialize_known
(constant, stationary_cov)Initialize the statespace model with known distribution for initial state.
Initialize the statespace model as stationary.
Properties
(array) Design matrix:
(dtype) Datatype of currently active representation matrices
(array) The observation vector, alias for obs.
(array) Observation vector:
(array) Observation covariance matrix:
(array) Observation intercept:
(str) BLAS prefix of currently active representation matrices
(array) Selection matrix:
(array) State covariance matrix:
(array) State intercept:
(bool) Whether or not currently active representation matrices are time-invariant
(array) Transition matrix: