Multivariate Regression With Lags
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Linear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!