I am trying to identify a state space model from discrete time series data in Python using statsmodels
library: statsmodel.tsa.statespace.sarimax.SARIMAX
.
I need the matrices of the state space general form (here the statsmodel reference): from the statsmodel page these matrices are explained but it is not clear how to extrapolate them.
For example if I want to apply a kalman filter to the identified model (by means of a sarimax) I need the matrices described in this picture state space matrices needed
Is it possible to obtain the matrices coefficients with statsmodel
?
All of the state space system matrices are saved in the filter_results
attribute of the fitted model. The names of the matrices are given in the links that you included in your answer (e.g. "design", etc.)
For example:
model = SARIMAX(Y_tr, exog = X_tr, order = (p,d,q), enforce_invertibility = False)
best_model = model.fit()
print(best_model.filter_results.design)
print(best_model.filter_results.obs_cov)
# ...