Learn R Programming

astsa (version 1.9)

acf2: Plot and print ACF and PACF of a time series

Description

Produces a simultaneous plot (and a printout) of the sample ACF and PACF on the same scale. The zero lag value of the ACF is removed.

Usage

acf2(series, max.lag=NULL, plot=TRUE, main=NULL, ylim=NULL,
     na.action = na.pass, ...)

Arguments

series

The data. Does not have to be a time series object.

max.lag

Maximum lag. Can be omitted. Defaults to \(\sqrt{n} + 10\) unless \(n < 60\). If the series is seasonal, this will be at least 4 seasons by default.

plot

If FALSE, no graph is produced but the values are still printed.

main

Title of graphic; defaults to name of series.

ylim

Specify limits for the y-axis.

na.action

How to handle missing data; default is na.pass

...

Additional arguments passed to acf

Value

ACF

The sample ACF

PACF

The sample PACF

%% ~Describe the value returned %% If it is a LIST, use %% \item{comp1 }{Description of 'comp1'} %% \item{comp2 }{Description of 'comp2'} %% ...

Details

This is basically a wrapper for acf() provided in tseries. The error bounds are approximate white noise bounds, \(0 \pm 2/\sqrt{n}\); no other option is given.

References

http://www.stat.pitt.edu/stoffer/tsa4/ and http://www.stat.pitt.edu/stoffer/tsda/

Examples

Run this code
# NOT RUN {
acf2(rnorm(100))
acf2(rnorm(100), 25, main='')  # no title
acf2(rnorm(100), plot=FALSE)[,'ACF']  # print only ACF
# }

Run the code above in your browser using DataLab