[R] acf and na.pass
Stéphane Dray
dray at biomserv.univ-lyon1.fr
Fri Jun 29 10:21:00 CEST 2007
Hello,
I would like to have some information about acf with missing values.
Let us consider this example:
x=rnorm(100)
x2=x
x2[sample(100,10)]=NA
acf1=acf(x)
acf2=acf(x2,na.action=na.pass)
The computation of the acf is different for the two data sets. Looking
at the the code reveals that with missing values, the computation of acf
takes into account the number of pairs of non-NA values (i.e. the number
of pairs of data that are used to compute the acf, and this number is
different for each lag). This makes sense for me. Where I have more
problems, concern the computation of confidence intervall. Here, the
plot.acf function compute the values using x$n.used, which is equal for
these two cases to 100. Is there some explanation for this choice ? I
would think that the computation of CI would also take into account the
number of pairs of non-NA values. Is there some references on the topic ?
Thanks in advance,
Sincerely.
--
Stéphane DRAY (dray at biomserv.univ-lyon1.fr )
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I
43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France
Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88
http://biomserv.univ-lyon1.fr/~dray/
More information about the R-help
mailing list