Learn R Programming

partsm (version 1.1-4)

acf.ext1: Autocorrelation function for several transformations of the original data

Description

This function is based on the acf function and extends it by allowing for some transformations of the data before computing the autocovariance or autocorrelation function.

Usage

acf.ext1 (wts, transf.type, perdiff.coeffs, type, lag.max, showcat, plot)

Value

Lags at which the acf is computed, estimates of the acf, and p-values for the significance of the acf at each lag.

Arguments

wts

a univariate time series object.

transf.type

a character string indicating what transformation should be applied to the data. Allowed values are "orig", "fdiff", "sdiff", "fsdiff", "fdiffsd", "perdiff", and ""perdiffsd. See details.

perdiff.coeffs

a vector with the estimates coefficients for the periodic difference filter. This argument is only required when the periodic difference transformation must be applied to the data. See details.

type

a character string giving the type of acf to be computed. Allowed values are "correlation", "covariance" or "partial".

lag.max

maximum number of lags at which to calculate the acf.

showcat

a logical. If TRUE, the results are printed in detail. If FALSE, the results are stored as a list object.

plot

a logical. If TRUE, a plot of the acf is showed.

Author

Javier Lopez-de-Lacalle javlacalle@yahoo.es.

Details

The implemented transformations are the following:

  • "orig": Original series.

  • "fdiff": First differences of the original series.

  • "sdiff": Seasonal differences of the original series.

  • "fsdiff": Fisrt and seasonal differences of the original series.

  • "fdiffsd": Residuals of the first differences on four seasonal dummy variables.

  • "perdiff": Periodic differences of the original series.

  • "perdiffsd": Residuals of the periodic differences on four seasonal dummy variables.

See Also

Examples

Run this code
      ## Logarithms of the Real GNP in Germany
      data("gergnp")
      lgergnp <- log(gergnp, base=exp(1))

      out <- acf.ext1(wts=lgergnp, transf.type="orig",
                      type="correlation", lag.max=12, showcat=TRUE, plot=FALSE)

      out <- acf.ext1(wts=lgergnp, transf.type="perdiffsd", 
                      perdiff.coeff = c(1.004, 0.981, 1.047, 0.969),
                      type="correlation", lag.max=12, showcat=TRUE, plot=FALSE)
   

Run the code above in your browser using DataLab