Dear All, Would like to ask the inconsistency in the autocorrelation from R with SPSS/Minitab. I have tried a dataset x with 20 data (1-20) and ask R to give the autocorrelation of different lags using the command < acf(x, lag.max=100, type = "correlation"), However while SPSS and Minitab give the same answers (0.85 for lag1), R gives 0.3688 which is much smaller. Obviously, the answers from SPSS/Minitab are correct by verifying in Excel. Is R using another definition in calculating the traditional autocorrelation for a time-series? Thanks for your attention. Would be very grateful if anyone can help. Yinny School of Mathematics & Statistics University of Sydney [[alternative HTML version deleted]]
Prof Brian Ripley
2008-Jul-06 08:33 UTC
[R] Different Autocorrelation using R and other softwares
It is not 'obvious' that SPSS/Minitab/Excel are right -- we quite often see users who wrongly assume that the autocorrelation is the Pearson correlation between a series and its lagged values. The correct definition is given in the reference on the help page for acf. Please note the footer to this message: you were asked for a reproducible example (and not to send HTML mail). In the absence of such an example we cannot investigate if this is user error (which seems the most plausible explanation.) On Sun, 6 Jul 2008, Yinny wrote:> Dear All, > > Would like to ask the inconsistency in the autocorrelation from R with > SPSS/Minitab. I have tried a dataset x with 20 data (1-20) and ask R to give > the autocorrelation of different lags using the command < acf(x, > lag.max=100, type = "correlation"), However while SPSS and Minitab give the > same answers (0.85 for lag1), R gives 0.3688 which is much smaller. > > Obviously, the answers from SPSS/Minitab are correct by verifying in > Excel. Is R using another definition in calculating the traditional > autocorrelation for a time-series? > > Thanks for your attention. Would be very grateful if anyone can help. > > Yinny > School of Mathematics & Statistics > University of Sydney > > [[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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595