Multivariate Regression With Lags
이전 댓글 표시
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개)
카테고리
도움말 센터 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!