Page 1 of 1

Computing Autocovariances

Posted: Wed Mar 02, 2011 1:29 pm
by cap
Greetings,

I am trying to use RATS to compute the autocovariances of a series. I use

correlate(covariances, results=mycovs) myvar

I am wondering if you can tell me what formula this instruction uses to compute these autocovariances. I tried looking in the reference manual under "correlate" but could not find this formula.

One thing that seems suspect is that the lag 0 autocovariance does not match the variance displayed under the STAT instruction. Also, I computed the autocovariances myself, using the following for lag k (for series y of length N):

gamma(k) = (1/N-k-1) * \sum_{i=k+1}^{N} (y_i - ybar) (y_{i-k} - ybar)


My answers are somewhat close, but still different, than those computed by RATS.
(at lag 0 my answer does match the variance shown under the STAT instruction)



Thanks for your help,

- cap

Re: Computing Autocovariances

Posted: Wed Mar 02, 2011 1:59 pm
by moderator
cap wrote: gamma(k) = (1/N-k-1) * \sum_{i=k+1}^{N} (y_i - ybar) (y_{i-k} - ybar)
It's a divisor of N (not N-k or N-k-1) for all lags.