acf function

Auto- and Cross- Covariance and -Correlation Function Estimation

Auto- and Cross- Covariance and -Correlation Function Estimation

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, ...)

Arguments

  • x: a univariate or multivariate (not ccf) numeric time series object or a numeric vector or matrix, or an "acf" object.
  • lag.max: 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.
  • type: character string giving the type of acf to be computed. Allowed values are "correlation" (the default), "covariance" or "partial".
  • plot: logical. If TRUE (the default) the acf is plotted.
  • na.action: function to be called to handle missing values. na.pass can be used.
  • demean: logical. Should the covariances be about the sample means?
  • drop.lag.0: logical. Should lag 0 be dropped
  • ...: further arguments to be passed to plot.acf.

Returns

An object of class "acf", which is a list with the following elements:

  • lag: A three dimensional array containing the lags at which the acf is estimated.

  • acf: An array with the same dimensions as lag containing the estimated acf.

  • type: The type of correlation (same as the type argument).

  • n.used: The number of observations in the time series.

  • series: The name of the series x.

  • snames: The series names for a multivariate time series.

References

~put references to the literature/web site here ~

Author(s)

Original authors of stats:::acf are: Paul Gilbert, Martyn Plummer, B.D. Ripley. This wrapper is written by Kung-Sik Chan

See Also

plot.acf, ARMAacf for the exact autocorrelations of a given ARMA process.

Examples

data(rwalk) model1=lm(rwalk~time(rwalk)) summary(model1) acf(rstudent(model1),main='')