- #1

emmasaunders12

- 43

- 0

For an vector AR(1) model of the form

y(t)=Ay(t-1) + et

How does one estimate the variance of the white noise input. I was under the impression that one can simply use the residual of the model fit and estimate the variance from this, when I do a simple simulation in MATLAB however I get very different results

%A small MATLAB

%simulated data

y=[1 2 4 8 16 32 64 128];

%remove mean for yule walker

y=y-repmat(mean(y),1,8);

[ar_coeffs err] = aryule(y,1);

%gives an estimate of the error variance as 1.3985e+003

inity=y(1);

estY(:,1)=inity;

for i=2:8

estY(:,i)=-ar_coeffs(2:end)*estY(i-1);

end

resid=y-estY;

var=sqrt((sum(resid.^2))/8-1);

Now variance in error = 38.3082 very different from before

Can anyone enlighten me, am I calculating the variance in the error correctly?

Thanks

Emma