Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Estimate the error variance of Autoregressive model

  1. Feb 7, 2014 #1
    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
     
  2. jcsd
  3. Feb 8, 2014 #2

    Stephen Tashi

    User Avatar
    Science Advisor

    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.
     
  4. Feb 8, 2014 #3
    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 Im going wrong?

    Thanks

    Emma
     
  5. Feb 8, 2014 #4

    Stephen Tashi

    User Avatar
    Science Advisor

    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.
     
  6. Feb 9, 2014 #5

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  7. Feb 9, 2014 #6

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    In your calculation of var, put parentheses around (7-1). You are dividing by 7 and subtracting 1 from the result.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Estimate the error variance of Autoregressive model
  1. Variance of estimator (Replies: 2)

Loading...