Multivariate Regression With Lags

2 ビュー (過去 30 日間)
Justas Dainauskas
Justas Dainauskas 2018 年 1 月 23 日
編集済み: Justas Dainauskas 2018 年 1 月 23 日
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 件)

カテゴリ

Help Center および File ExchangeLinear Regression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by