Problem with vector autoregressive model (vgxvarx) - "Covariance is not positive-definite."
14 ビュー (過去 30 日間)
古いコメントを表示
Hi.
I have a dataset of 27 different variables measured during the same time period with the same lengths that I am trying to create a vector autoregressive model of using the method shown in the webinar “ Long Term Energy Forecasting with Econometrics in MATLAB ” which is basically:
Y=data; %10000x27 matrix of data
nAR = 12; % Define number of lags
Spec = vgxset('n', numel(YSeries), 'Constant', true, 'nAR', nAR, 'Series', YSeries);
Spec = vgxvarx(Spec, Y);
If I try running this with only two of the vectors Y(:,1:2) it works but the model obviously isn’t very good. When I start introducing more vectors to the model for example Y(:,1:10) I always get the error:
Error using mvregress (line 452)
Covariance is not positive-definite.
And I am unable to build the model.
What am I doing wrong here? In the webinar example he has many input vectors and the code never complains...
Thanks.
0 件のコメント
採用された回答
Hang Qian
2015 年 7 月 28 日
Hi Peta,
The codes appear syntactically correct. You might want to check the correlations of your 27 variables and the constant term, making sure they are not perfectly correlated. You may also consider a more parsimonious model, as 12 lags would imply more than 8000 unknown parameters in the model. There is a chance that numerical problems make the covariance matrix non-positive definite, though they are positive definite in theory. Also, most users would partition the data and set the name-value pair “Y0” as the initial observations, and Y for the remaining sample. This will yield the OLS results. The default “Y0” are padded by zeros.
- Hang Qian
2 件のコメント
Hang Qian
2015 年 8 月 12 日
Thank you very much for your suggestions on the single-precision algebra for the VAR model!
その他の回答 (1 件)
Maisa Melo
2018 年 8 月 28 日
Hi Peta,
I need implement a code using vgxvarx at Matlab, but I'm not know exacly how is the input data. I'm trying reproduce your code, but in your code there is no the valur of YSeries. I would like know your YSeries for I reproduce your code.
Best regard.
Maisa
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!