Computing Autocovariances

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
cap
Posts: 11
Joined: Thu Aug 14, 2008 2:32 pm

Computing Autocovariances

Unread post 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
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: Computing Autocovariances

Unread post 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.
Post Reply