Estimate the error variance of Autoregressive model

Click For Summary

Discussion Overview

The discussion revolves around estimating the error variance of a vector autoregressive model (AR(1)). Participants explore methods for calculating this variance, particularly in the context of MATLAB simulations and the use of the aryule function.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Emma presents a method for estimating the variance of the white noise input using residuals from a fitted AR(1) model and shares MATLAB code for simulation.
  • One participant points out that Emma's calculation of variance appears to be an estimate of standard deviation and notes that the first prediction being set equal to the first datum may force the residual to be zero.
  • Emma adjusts her calculation by excluding the first estimated term but finds a different result than expected, prompting her to seek further clarification.
  • Another participant suggests that the aryule function's results may differ from Emma's method because it estimates both the coefficients and the variance from the data, while Emma's method assumes the coefficients are known.
  • A participant raises concerns about the impact of subtracting the mean from the data, suggesting it could affect the fitting of the model due to sign changes in the data.
  • One participant advises Emma to correct her variance calculation by properly grouping the denominator in her formula.

Areas of Agreement / Disagreement

Participants express differing views on the methods for estimating variance and the implications of the calculations. There is no consensus on the correct approach or the reasons for discrepancies in results.

Contextual Notes

Participants highlight potential limitations in the calculations, such as the treatment of the first prediction, the method of mean subtraction, and the choice of divisor in variance estimation. These factors remain unresolved.

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.
 

Similar threads

  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K