Multivariate Regression With Lags
4 次查看(过去 30 天)
显示 更早的评论
Suppose I have a T-by-n vector of data called y. I generate 4 lags for it using
ym=lagmatrix(y,1:4);
I want to regress each column of y on four columns of ym (a T-by-4n matrix) that represent lags of y. That is, for i=1, y must be regressed on the 1st, the (n+1)st, the (2*n+1)st, the (3*n+1)st columns of ym, then for i=2, etc. up until i=n.
I've tried this
[b,varcoy,resid,varcob,logL] = mvregress(ym,y);
But the covariance matrix is not positive-definite and I doubt that it recognises my intention in the first place. I've tried using loops and the function 'fitlm', but the output cannot be stored within the loop.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!