EVOLUTION-MANAGER
Edit File: acf.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Auto- and Cross- Covariance and -Correlation Function...</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for acf {stats}"><tr><td>acf {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Auto- and Cross- Covariance and -Correlation Function Estimation</h2> <h3>Description</h3> <p>The function <code>acf</code> computes (and by default plots) estimates of the autocovariance or autocorrelation function. Function <code>pacf</code> is the function used for the partial autocorrelations. Function <code>ccf</code> computes the cross-correlation or cross-covariance of two univariate series. </p> <h3>Usage</h3> <pre> 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, ...) ## Default S3 method: 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, ...) ## S3 method for class 'acf' x[i, j] </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, y</code></td> <td> <p>a univariate or multivariate (not <code>ccf</code>) numeric time series object or a numeric vector or matrix, or an <code>"acf"</code> object.</p> </td></tr> <tr valign="top"><td><code>lag.max</code></td> <td> <p>maximum lag at which to calculate the acf. Default is <i>10*log10(N/m)</i> where <i>N</i> is the number of observations and <i>m</i> the number of series. Will be automatically limited to one less than the number of observations in the series.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>character string giving the type of acf to be computed. Allowed values are <code>"correlation"</code> (the default), <code>"covariance"</code> or <code>"partial"</code>. Will be partially matched.</p> </td></tr> <tr valign="top"><td><code>plot</code></td> <td> <p>logical. If <code>TRUE</code> (the default) the acf is plotted.</p> </td></tr> <tr valign="top"><td><code>na.action</code></td> <td> <p>function to be called to handle missing values. <code>na.pass</code> can be used.</p> </td></tr> <tr valign="top"><td><code>demean</code></td> <td> <p>logical. Should the covariances be about the sample means?</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments to be passed to <code>plot.acf</code>.</p> </td></tr> <tr valign="top"><td><code>i</code></td> <td> <p>a set of lags (time differences) to retain.</p> </td></tr> <tr valign="top"><td><code>j</code></td> <td> <p>a set of series (names or numbers) to retain.</p> </td></tr> </table> <h3>Details</h3> <p>For <code>type</code> = <code>"correlation"</code> and <code>"covariance"</code>, the estimates are based on the sample covariance. (The lag 0 autocorrelation is fixed at 1 by convention.) </p> <p>By default, no missing values are allowed. If the <code>na.action</code> function passes through missing values (as <code>na.pass</code> 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. </p> <p>The partial correlation coefficient is estimated by fitting autoregressive models of successively higher orders up to <code>lag.max</code>. </p> <p>The generic function <code>plot</code> has a method for objects of class <code>"acf"</code>. </p> <p>The lag is returned and plotted in units of time, and not numbers of observations. </p> <p>There are <code>print</code> and subsetting methods for objects of class <code>"acf"</code>. </p> <h3>Value</h3> <p>An object of class <code>"acf"</code>, which is a list with the following elements: </p> <table summary="R valueblock"> <tr valign="top"><td><code>lag</code></td> <td> <p>A three dimensional array containing the lags at which the acf is estimated.</p> </td></tr> <tr valign="top"><td><code>acf</code></td> <td> <p>An array with the same dimensions as <code>lag</code> containing the estimated acf.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>The type of correlation (same as the <code>type</code> argument).</p> </td></tr> <tr valign="top"><td><code>n.used</code></td> <td> <p>The number of observations in the time series.</p> </td></tr> <tr valign="top"><td><code>series</code></td> <td> <p>The name of the series <code>x</code>.</p> </td></tr> <tr valign="top"><td><code>snames</code></td> <td> <p>The series names for a multivariate time series.</p> </td></tr> </table> <p>The lag <code>k</code> value returned by <code>ccf(x, y)</code> estimates the correlation between <code>x[t+k]</code> and <code>y[t]</code>. </p> <p>The result is returned invisibly if <code>plot</code> is <code>TRUE</code>. </p> <h3>Author(s)</h3> <p>Original: Paul Gilbert, Martyn Plummer. Extensive modifications and univariate case of <code>pacf</code> by B. D. Ripley. </p> <h3>References</h3> <p>Venables, W. N. and Ripley, B. D. (2002) <em>Modern Applied Statistics with S</em>. Fourth Edition. Springer-Verlag. </p> <p>(This contains the exact definitions used.) </p> <h3>See Also</h3> <p><code><a href="plot.acf.html">plot.acf</a></code>, <code><a href="ARMAacf.html">ARMAacf</a></code> for the exact autocorrelations of a given ARMA process. </p> <h3>Examples</h3> <pre> 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) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>