acfcomputes (and by default plots) estimates of the autocovariance or autocorrelation function. Function
pacfis the function used for the partial autocorrelations. Function
ccfcomputes the cross-correlation or cross-covariance of two univariate series.
acf(x, lag.max = NULL, type = c("correlation", "covariance", "partial"), plot = TRUE, na.action = na.fail, demean = TRUE, ...)pacf(x, lag.max, plot, na.action, ...)"pacf"(x, lag.max = NULL, plot = TRUE, na.action = na.fail, ...)ccf(x, y, lag.max = NULL, type = c("correlation", "covariance"), plot = TRUE, na.action = na.fail, ...)"["(x, i, j)
ccf) numeric time series object or a numeric vector or matrix, or an
"partial". Will be partially matched.
TRUE(the default) the acf is plotted.
na.passcan be used.
"acf", which is a list with the following elements:
lagcontaining the estimated acf.
kvalue returned by
ccf(x, y)estimates the correlation between
y[t].The result is returned invisibly if
"covariance", the estimates are based on the sample covariance. (The lag 0 autocorrelation is fixed at 1 by convention.)
By default, no missing values are allowed. If the
function passes through missing values (as
na.pass does), the
covariances are computed from the complete cases. This means that the
estimate computed may well not be a valid autocorrelation sequence,
and may contain missing values. Missing values are not allowed when
computing the PACF of a multivariate time series.
The partial correlation coefficient is estimated by fitting
autoregressive models of successively higher orders up to
The generic function
plot has a method for objects of class
The lag is returned and plotted in units of time, and not numbers of observations.
(This contains the exact definitions used.)
ARMAacffor the exact autocorrelations of a given ARMA process.
require(graphics) ## Examples from Venables & Ripley acf(lh) acf(lh, type = "covariance") pacf(lh) acf(ldeaths) acf(ldeaths, ci.type = "ma") acf(ts.union(mdeaths, fdeaths)) ccf(mdeaths, fdeaths, ylab = "cross-correlation") # (just the cross-correlations) presidents # contains missing values acf(presidents, na.action = na.pass) pacf(presidents, na.action = na.pass)