

   acf {ts}                                     R Documentation

   AAuuttooccoovvaarriiaannccee aanndd AAuuttooccoorrrreellaattiioonn FFuunnccttiioonn EEssttiimmaattiioonn

   DDeessccrriippttiioonn::

        The function `acf' computes (and by default plots)
        estimates of the autocovariance or autocorrelation
        function.  Function `pacf' is the function used for the
        partial autocorrelations.

        Function `ccf' computes the cross-correlation or cross-
        covariance of two univariate series.

        The generic function `plot' has a method for `acf'
        objects.

   UUssaaggee::

        acf(x, lag.max = NULL,
            type = c("correlation", "covariance", "partial"),
            plot = TRUE, na.action, demean = TRUE, ...)
        pacf(x, lag.max = NULL, plot = TRUE, na.action, ...)
        ccf(x, y, lag.max = NULL, type = c("correlation", "covariance"),
            plot = TRUE,na.action, ...)

        plot.acf(acf.obj, ci=0.95, ci.col="blue", ci.type=c("white", "ma"), ...)

   AArrgguummeennttss::

       x, y: a univariate or multivariate (not `ccf') time
             series object or a numeric vector or matrix.

    lag.max: maximum lag at which to calculate the acf.
             Default is 10*log10(N) where N is the number of
             observations.

       plot: logical. If `TRUE' the acf is plotted.

       type: character string giving the type of acf to be com-
             puted.  Allowed values are `"correlation"' (the
             default), `"covariance"' or `"partial"'.

   na.action: function to be called to handle missing values.

     demean: logical. Should the covariances be about the sam-
             ple means?

    acf.obj: an object of class `acf'.

         ci: coverage probability for confidence interval.
             Plotting of the confidence interval is suppressed
             if `ci' is zero or negative.

     ci.col: colour to plot the confidence interval lines.

    ci.type: should the confidence limits assume a white noise
             input or for lag `k' an MA(`k-1') input?

        ...: graphical parameters.

   DDeettaaiillss::

        For `type' = `"correlation"' and `"covariance"', the
        estimates are based on the sample covariance.

        The partial correlation coefficient is estimated by
        fitting autoregressive models of successively higher
        orders up to `lag.max'.

   VVaalluuee::

        An object of class `acf', which is a list with the fol-
        lowing elements:

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

        acf: An array with the same dimensions as `lag' con-
             taining the estimated acf.

       type: The type of correlation (same as the `type' argu-
             ment).

     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.

             The result is returned invisibly if `plot' is
             `TRUE'.

   NNoottee::

        The confidence interval plotted in `plot.acf' is based
        on an uncorrelated series and should be treated with
        appropriate caution. Using `ci.type = "ma"' may be less
        potentially misleading.

   AAuutthhoorr((ss))::

        Original: Paul Gilbert, Martyn Plummer.  Extensive mod-
        ifications and univariate case of `pacf' by B.D. Rip-
        ley.

   EExxaammpplleess::

        ## Examples from Venables & Ripley
        data(lh)
        acf(lh)
        acf(lh, type="covariance")
        pacf(lh)

        data(UKLungDeaths)
        acf(ldeaths)
        acf(ldeaths, ci.type="ma")
        acf(ts.union(mdeaths, fdeaths))
        ccf(mdeaths, fdeaths) # just the cross-correlations.

