Standard errors may be unstable.

94 views
Skip to first unread message

D. K

unread,
Oct 25, 2023, 3:12:27 AM10/25/23
to pystatsmodels
Hello everyone,

I ran a state space VARMAX (AR(1)) model, and while it attempts to converge, I receive two cautions when the results are displayed.

[1] Covariance matrix calculated using the outer product of gradients (complex-step). 

[2] Covariance matrix is singular or near-singular, with condition number 9.69e+20. Standard errors may be unstable. 



 How is this resolved?

Thank you very much.

David

D. K

unread,
Oct 25, 2023, 2:01:42 PM10/25/23
to pystatsmodels
This is an update of my previous message. I ran the model with a regularization_type='l2' in the VARMAX .   I still receive two warnings when the results are displayed.
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

 [2] Covariance matrix is singular or near-singular, with condition number (For privacy, I will not display the number, but it is still a large one.). Standard errors may be unstable.


This time the condition number was reduced to one third with respect to the first estimation. 

What do the warnings written upon VARMAX summary mean? Does it heavily affect my model performance and how to resolve it?

I suspect multicollinearity, but given that I run a Big  data VARMAX with related variables that might work in opposite signs, chances are multicollinearity to be present. 

I did not have a maximum likelihood optimization did not converge error. Only the warnings. 

 Can I still go ahead with the model under these conditions? I'm mostly interesting to analyze the time varying stochastic volatility and the Impulse responses functions of the model. Additionally, what does the second warming mean ?

Thank you again very much for your time and contribution.

Best,
David

Chad Fulton

unread,
Oct 26, 2023, 10:55:52 AM10/26/23
to pystat...@googlegroups.com
The VARMAX model estimates parameters by using numerical methods to maximize the likelihood function.  Because the number of parameters can be very large in a VAR model, it can be very difficult for the optimizer to achieve this, which often leads to problems with convergence.

Similarly, even if the model has converged, the standard errors are computed by numerically approximating the Hessian, and this is an even more fragile numerical computation, particularly when there are a lot of parameters.

So I'm not surprised you're seeing those messages, but I am not sure that there is anything that I can suggest.  With a VAR model that has more than a few variables and a few lags, I would personally generally use Bayesian methods to estimate the parameters, using some kind of Minnesota-like prior to achieve a kind of regularization.  But we do not have any of these methods available in Statsmodels.

Best,
Chad


--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/239f03d1-e244-4546-81aa-193e650e7f27n%40googlegroups.com.

D. K

unread,
Oct 27, 2023, 8:12:35 PM10/27/23
to pystatsmodels
Thank you very much, Chad, for the reply and the input.

I have had the thought of trying to normalize the data. Since I am interested in time-varying volatility coefficients and IRFs in the VAR, both standard and time-varying IRFs, in the state space varmax AR(1), one lag,  to what extent will the data normalization affect those results or even help to overcome the issue? If that is the way to go, it will save me 8 hours of waiting to converge.

David 



The VARMAX model estimates parameters by using numerical methods to maximize the likelihood function.  Because the number of parameters can be very large in a VAR model, it can be very difficult for the optimizer to achieve this, which often leads to problems with convergence.

Similarly, even if the model has converged, the standard errors are computed by numerically approximating the Hessian, and this is an even more fragile numerical computation, particularly when there are a lot of parameters.

So I'm not surprised you're seeing those messages, but I am not sure that there is anything that I can suggest.  With a VAR model that has more than a few variables and a few lags, I would personally generally use Bayesian methods to estimate the parameters, using some kind of Minnesota-like prior to achieve a kind of regularization.  But we do not have any of these methods available in Statsmodels.

Best,
Chad


 
This is an update of my previous message. I ran the model with a regularization_type='l2' in the VARMAX .   I still receive two warnings when the results are displayed.

[1] Covariance matrix calculated using the outer product of gradients (complex-step).

 [2] Covariance matrix is singular or near-singular, with condition number (For privacy, I will not display the number, but it is still a large one.). Standard errors may be unstable.


This time the condition number was reduced to one third with respect to the first estimation. 

What do the warnings written upon VARMAX summary mean? Does it heavily affect my model performance and how to resolve it?

I suspect multicollinearity, but given that I run a Big  data VARMAX with related variables that might work in opposite signs, chances are multicollinearity to be present. 

I did not have a maximum likelihood optimization did not converge error. Only the warnings. 

 Can I still go ahead with the model under these conditions? I'm mostly interesting to analyze the time varying stochastic volatility and the Impulse responses functions of the model. Additionally, what does the second warming mean ?

Thank you again very much for your time and contribution.

Best,
David
Hello everyone,

I ran a state space VARMAX (AR(1)) model, and while it attempts to converge, I receive two cautions when the results are displayed.

[1] Covariance matrix calculated using the outer product of gradients (complex-step). 

[2] Covariance matrix is singular or near-singular, with condition number 9.69e+20. Standard errors may be unstable. 



 How is this resolved?

Thank you very much.

David

Reply all
Reply to author
Forward
0 new messages