ACF.gls {nlme} | R Documentation |
Autocorrelation Function for gls Residuals
Description
This method function calculates the empirical autocorrelation function
for the residuals from a gls
fit. If a grouping variable is
specified in form
, the autocorrelation values
are calculated using pairs of residuals within the same group;
otherwise all possible residual pairs are used. The autocorrelation
function is useful for investigating serial correlation models for
equally spaced data.
Usage
## S3 method for class 'gls'
ACF(object, maxLag, resType, form, na.action, ...)
Arguments
object |
an object inheriting from class |
maxLag |
an optional integer giving the maximum lag for which the autocorrelation should be calculated. Defaults to maximum lag in the residuals. |
resType |
an optional character string specifying the type of
residuals to be used. If |
form |
an optional one sided formula of the form |
na.action |
a function that indicates what should happen when the
data contain |
... |
some methods for this generic require additional arguments. |
Value
a data frame with columns lag
and ACF
representing,
respectively, the lag between residuals within a pair and the corresponding
empirical autocorrelation. The returned value inherits from class
ACF
.
Author(s)
José Pinheiro and Douglas Bates bates@stat.wisc.edu
References
Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series Analysis: Forecasting and Control", 3rd Edition, Holden-Day.
Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models in S and S-PLUS", Springer.
See Also
Examples
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary)
ACF(fm1, form = ~ 1 | Mare)
# Pinheiro and Bates, p. 255-257
fm1Dial.gls <- gls(rate ~
(pressure+I(pressure^2)+I(pressure^3)+I(pressure^4))*QB,
Dialyzer)
fm2Dial.gls <- update(fm1Dial.gls,
weights = varPower(form = ~ pressure))
ACF(fm2Dial.gls, form = ~ 1 | Subject)