\Header{ACF.lme}{Autocorrelation Function for lme Residuals}
\keyword{models}{ACF.lme}
\begin{Description}\relax
This method function calculates the empirical autocorrelation function
for the within-group residuals from an \code{lme} fit. The
autocorrelation values are calculated using pairs of residuals within
the innermost group level. The autocorrelation function is  useful for
investigating serial correlation models for equally spaced data.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'lme':
ACF(object, maxLag, resType, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an object inheriting from class \code{lme}, representing
a fitted linear mixed-effects model.
\item[\code{maxLag}] an optional integer giving the maximum lag for which the
autocorrelation should be calculated. Defaults to maximum lag in the
within-group residuals.
\item[\code{resType}] an optional character string specifying the type of
residuals to be used. If \code{"response"}, the "raw" residuals
(observed - fitted) are used; else, if \code{"pearson"}, the
standardized residuals (raw residuals divided by the corresponding
standard errors) are used; else, if \code{"normalized"}, the
normalized residuals (standardized residuals pre-multiplied by the
inverse square-root factor of the estimated error correlation
matrix) are used. Partial matching of arguments is used, so only the
first character needs to be provided. Defaults to \code{"pearson"}.
\item[\code{...}] some methods for this generic require additional
arguments -- not used.
\end{ldescription}
\end{Arguments}
\begin{Value}
a data frame with columns \code{lag} and \code{ACF} representing,
respectively, the lag between residuals within a pair and the corresponding
empirical autocorrelation. The returned value inherits from class
\code{ACF}.
\end{Value}
\begin{Author}\relax
Jose Pinheiro \email{Jose.Pinheiro@pharma.novartis.com} and Douglas Bates \email{bates@stat.wisc.edu}
\end{Author}
\begin{References}\relax
Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series
Analysis: Forecasting and Control", 3rd Edition, Holden-Day.
\end{References}
\begin{SeeAlso}\relax
\code{\Link{ACF.gls}}, \code{\Link{plot.ACF}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(Ovary)
fm1 <- lme(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
           random = ~ sin(2*pi*Time) | Mare)
ACF(fm1, maxLag = 11)
\end{ExampleCode}
\end{Examples}

