[R] a question on autocorrelation acf

John Ramey johnramey at gmail.com
Fri Apr 30 17:56:49 CEST 2010


I think you are Googling the wrong "reference."  Note in ?acf the following:

References:

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S_.  Fourth Edition.  Springer-Verlag.

     (This contains the exact definitions used.)

On Fri, Apr 30, 2010 at 10:42 AM, zhenjiang xu <zhenjiang.xu at gmail.com> wrote:
> Thanks, Duncan, but there are no reference in ?acf. The only probably
> related stuff is
>
> "Author(s):
>
>     Original: Paul Gilbert, Martyn Plummer. Extensive modifications
>     and univariate case of 'pacf' by B.D. Ripley."
>
> And I didn't find anything with google search of it.
>
>
> On Thu, Apr 29, 2010 at 7:08 PM, Duncan Murdoch <murdoch.duncan at gmail.com>wrote:
>
>> On 29/04/2010 6:22 PM, zhenjiang xu wrote:
>>
>>> Hi R users,
>>>
>>> where can I find the equations used by acf function to calculate
>>> autocorrelation?
>>>
>>
>> See the reference listed in ?acf.
>>
>> Duncan Murdoch
>>
>>
>>   I think I misunderstand acf. Doesn't acf use following
>>> equation to calculate autocorrelation?
>>> [image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} -
>>> \mu)]}{\sigma^2}\, ,]
>>> If it does, then the autocorrelation of a sine function should give a
>>> cosine; however, the following code gives a cosine-shape function with its
>>> magnitude decreasing along the lag.
>>> x = c(1:500)
>>> x = x/10
>>> x = sin(x)
>>> acf(x, type='correlation', lag.max=length(x)-1)
>>>
>>>
>>>
>>
>>
>
>
> --
> Best,
> Zhenjiang
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
John A. Ramey, M.S.
Ph.D. Candidate
Department of Statistics
Baylor University



More information about the R-help mailing list