This function calls the acf function in the stats package and processes to drop lag-0 of the acf. It only works for univariate time series, so x below should be 1-dimensional.
acf(x, lag.max = NULL, type = c("correlation", "covariance", "partial")[1],
plot = TRUE, na.action = na.fail, demean = TRUE, drop.lag.0 = TRUE, ...)
a univariate or multivariate (not ccf) numeric time series object or a numeric vector or matrix, or an "acf" object.
maximum number of lags at which to calculate the acf. Default is 10*log10(N/m) where N is the number of observations and m the number of series.
character string giving the type of acf to be computed. Allowed values are "correlation" (the default), "covariance" or "partial".
logical. If TRUE (the default) the acf is plotted.
function to be called to handle missing values. na.pass can be used.
logical. Should the covariances be about the sample means?
logical. Should lag 0 be dropped
further arguments to be passed to plot.acf.
An object of class "acf", which is a list with the following elements:
A three dimensional array containing the lags at which the acf is estimated.
An array with the same dimensions as lag containing the estimated acf.
The type of correlation (same as the type argument).
The number of observations in the time series.
The name of the series x.
The series names for a multivariate time series.
~put references to the literature/web site here ~
plot.acf
, ARMAacf
for the exact autocorrelations of a given ARMA process.
# NOT RUN {
data(rwalk)
model1=lm(rwalk~time(rwalk))
summary(model1)
acf(rstudent(model1),main='')
# }
Run the code above in your browser using DataLab