[R] Re: R-help Digest, Vol 2, Issue 13

About this list Date view Thread view Subject view Author view Attachment view

From: Adrian Trapletti (adrian.trapletti@lmttrading.com)
Date: Mon 14 Apr 2003 - 18:22:59 EST


Message-id: <3E9A6FE3.487BC7DD@lmttrading.com>


> Subject: [R] Autocovariance and acf
> Date: Sat, 12 Apr 2003 05:17:51 +0200
> From: christianlederer@t-online.de (Christian Lederer)
> Reply-To: lederer@trium.de
> To: R-Help <r-help@stat.math.ethz.ch>
>
> Hi,
>
> i calculated the autocovariance of a vector x of length n, using
>
> result <- acf(x, lag, type="covariance")
>
> and expected, that result$acf would contain the values
> cov(x,x), cov(x[1:(n-1)], x[2:n]) ...
>
> However, acf does not calculate this covariances. Instead
> of cov(x[1:(n-i)], x[(i+1):n]) i am getting
>
> ( (x[1] - m) * (x[i+1]-m) + ... + (x[n-i]-m) * (x[n]-m) ) / n
>
> where m = mean(x).

There are many possibilities to estimate the autocovariance function. acf implements the standard estimator. Your suggestion has some disadvantages: See, e.g., in Lütkepohl (1994), Zeitreihenanalyse, 5. Auflage, pp. 236, and in particular p. 243 (I guess you understand German).

> I anderstand, that for efficiency reasons only the mean of the whole
> vector x is substracted instead of the means of the partial vectors.
> But why does it divide by n instead of n-i?
>
> Christian

best
Adrian

--
Dr. Adrian Trapletti             Phone :             +41 (0) 1 994 5631
Trapletti Statistical Computing  Mobile:             +41 (0)76 370 5631
Wildsbergstrasse 31              Fax   :             +41 (0) 1 994 5631
CH-8610 Uster                    Email :  mailto:a.trapletti@bluewin.ch
Switzerland                      WWW   : http://trapletti.homelinux.com

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:41 EST