Estimate the error variance of Autoregressive model

Click For Summary
In the discussion about estimating the error variance of a vector AR(1) model, the user Emma seeks clarification on discrepancies between her calculated variance and the output from MATLAB's aryule function. It is noted that Emma's method for calculating variance may be incorrect, as she initially used an estimate of the standard deviation instead. The suggestion is made to adjust her calculations by using the unbiased estimator for variance, dividing by 7 instead of 8. Additionally, concerns are raised about the impact of subtracting the mean from the data, which could affect the model's fit. The conversation emphasizes the differences in assumptions between Emma's approach and the aryule function's methodology.
emmasaunders12
Messages
43
Reaction score
0
Hi everyone, hopefully someone can help

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
 
Physics news on Phys.org
emmasaunders12 said:
var=sqrt((sum(resid.^2))/8-1);

This looks like an estimate of the standard deviation, not the variance.

Also you method sets the first prediction equal to the first datum, so that residual is forced to be zero. You only have 7 samples that are useful for estimating the variance of the noise. If you used the unbiased estimator of the variance, you'd divide by 7-1 instead of 8-1.

I don't see where your code defines the array estY.
 
Hi stephen thanks for the help,

Emitting the first estimated term and using:

var=((sum(resid(2:end).^2)/7-1));

gives me 1.6773e+003, not 1.3985e+003 reported by matlab, have you any idea where I am going wrong?

Thanks

Emma
 
I wouldn't expect the aryule function to give the same result as your method. The aryule function estimates both the value of A and the variance of e_t from the data. Your method assumes the value A is known and estimates the variance of e_t from the data.

I haven't studied the details of how aryule works. I think we could figure them out from something like this PDF http://www.google.com/url?sa=t&rct=...LkMzAAr2z1c67pA&bvm=bv.60983673,d.aWM&cad=rja

I think aryule finds the numbers that make the predictions of the model give the best "least squares" fit to the data Those numbers might not be the ones that make the model exactly match the data at t = 1.
 
I am suspicious of the way you subtract the mean of the y's. Doesn't that make all the early y's negative and the later y's positive? A model Y(t) = A*Y(t-1) would be hard to fit to data that changes sign that way. Seems like your original data should have given a perfect fit of Y(t) = 2 * Y(t-1) with no errors.
 
In your calculation of var, put parentheses around (7-1). You are dividing by 7 and subtracting 1 from the result.
 
If there are an infinite number of natural numbers, and an infinite number of fractions in between any two natural numbers, and an infinite number of fractions in between any two of those fractions, and an infinite number of fractions in between any two of those fractions, and an infinite number of fractions in between any two of those fractions, and... then that must mean that there are not only infinite infinities, but an infinite number of those infinities. and an infinite number of those...

Similar threads

  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
Replies
0
Views
884
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K