0

I am attempting to run a TVP-VAR model, exactly, as written on the statsmodels model page:

https://www.statsmodels.org/stable/examples/notebooks/generated/statespace_custom_models.html#Model-1:-time-varying-coefficients

I get an error.

Non-positive-definite observation covariance matrix encountered at period 0

This happens in step 14 of the model page

mod.update_variances

 File statsmodels/tsa/statespace/_cfa_simulation_smoother.pyx:616 in statsmodels.tsa.statespace._cfa_simulation_smoother.dCFASimulationSmoother.update_sparse_posterior_moments 



LinAlgError: Non-positive-definite observation covariance matrix encountered at period 0 

I suspect it has to do with the data itself or the parameters. I have no exogenous variables; however, I have gaps in the data.

I set in the definitions of super" and "exog =none without being able to solve them. I also attempted to drop the gaps (although it violates my model) by setting df = df.dropna() and letting exog = z_t, but again, without being able to resolve (dropping na is not at all desirable), I get an occurrence in several rows at the beginning, which is certainly not an error.

Furthermore, I have also seen this tutorial provided on: https://stats.stackexchange.com/questions/514668/initial-conditions-for-statespace-mlemodel-in-statsmodel

but I am getting an error on the size of the update state_cov (I have numerous variables, resulting in a 756x756 matrix size for 78 years),

I would like to kindly ask anyone of you has really the time to help me with some line code to solve the issue, eventually adding impulse response functions at the end of the code. Thank you very much in advance.

MarioF
  • 1
  • 1

0 Answers0