From: Ivana Gosevac on
I am supposed to perform quite large number of expanding window regressions. For this reason I use ols function from Econometrics Toolbox

For the purposes of regression, I need to save always the last residual in each regression I perform. So I wrote the code:

n=length(IPI)
k=1:n

for k=60:n
ols(IPI(1:k,1),tt2(1:k,:))
k=k+1
end

however what this code does is just performs one regression after another and saves the output for only the last regression. How can I store a vector of last residuals from each regression I make?

Thank you in advance,

Ivana
From: William Mueller on
"Ivana Gosevac" <ivanad_yu(a)yahoo.com> wrote in message <ht5rps$sst$1(a)fred.mathworks.com>...
> I am supposed to perform quite large number of expanding window regressions. For this reason I use ols function from Econometrics Toolbox
>
> For the purposes of regression, I need to save always the last residual in each regression I perform. So I wrote the code:
>
> n=length(IPI)
> k=1:n
>
> for k=60:n
> ols(IPI(1:k,1),tt2(1:k,:))
> k=k+1
> end
>
> however what this code does is just performs one regression after another and saves the output for only the last regression. How can I store a vector of last residuals from each regression I make?
>
> Thank you in advance,
>
> Ivana

Ivana:

OLS is a function in LeSage's Econometrics Toolbox, not ours. We don't support it. For OLS in MATLAB, consider MLDIVIDE and the related documentation on regression.

-Bill Mueller
MathWorks Econometrics Toolbox Development