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.dun...@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@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.