Learn R Programming

TSA (version 1.01)

acf: Auto- and Cross- Covariance and -Correlation Function Estimation

Description

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.

Usage

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.

Value

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 ~

See Also

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

Examples

Run this code
# NOT RUN {
data(rwalk)
model1=lm(rwalk~time(rwalk))
summary(model1)
acf(rstudent(model1),main='')
# }

Run the code above in your browser using DataLab