[R] acf gives correlations > 1
Duncan Murdoch
murdoch at stats.uwo.ca
Mon Sep 14 14:30:28 CEST 2009
On 14/09/2009 7:44 AM, Steve Jones wrote:
> Apologies for the missing data. It can be downloaded from here (22Kb):
> http://www.squaregoldfish.co.uk/sekrett/series.csv
The dataset is 97% missing values. I suspect what you're seeing is what
the man page describes as follows:
"If the na.action function passes through missing values (as na.pass
does), the covariances are computed from the complete cases. This means
that the estimate computed may well not be a valid autocorrelation
sequence,"
Duncan Murdoch
>
> Steve.
>
> Duncan Murdoch wrote:
>> On 14/09/2009 6:40 AM, Steve Jones wrote:
>>> Hi list,
>>>
>>> I've been producing autocorrelation functions of time series using the
>>> acf function, and have found a series or two for which correlations of >
>>> 1 are given, which I think shouldn't happen.
>>>
>>> Attached is the time series I'm using, and below is the R code (version
>>> 2.9.1) that I'm entering:
>>>
>>> series <- read.csv("series.csv")
>>> corr <- acf(series, lag.max=90, na.action=na.pass, plot=T)
>>>
>>> The first few values of corr are below:
>>>
>>> 0 1.000
>>> 1 1.258
>>> 2 1.192
>>> 3 1.266
>>> 4 0.864
>>> 5 0.637
>>>
>>> The entries of concern are 1-3 - surely these results are invalid?
>>>
>>> I'd be grateful if you could shed any light on this for me.
>>>
>> Your data file didn't show up. (Some attachments are stripped; it's
>> better to include data inline.)
>>
>> Duncan Murdoch
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list