Learn R Programming

astsa (version 1.12)

acf1: Plot and print ACF or PACF of a time series

Description

Produces a plot (and a printout) of the sample ACF or PACF. The zero lag value of the ACF is removed.

Usage

acf1(series, max.lag=NULL, plot=TRUE, main=NULL, ylim=NULL, pacf=FALSE,
     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 TRUE (default), a graph is produced and the values are rounded and listed. If FALSE, no graph is produced and the values are listed but not rounded by the script.

main

Title of graphic; defaults to name of series.

ylim

Specify limits for the y-axis.

pacf

If TRUE, the sample PACF is returned instead of ACF.

na.action

How to handle missing data; default is na.pass

...

Additional arguments passed to acf

Value

ACF

The sample ACF or PACF

Details

Will plot and print the sample ACF or PACF (if pacf=TRUE). The zero lag of the ACF (which is always 1) has been removed. If plot=TRUE, a graph is produced and the values are rounded and listed. If FALSE, no graph is produced and the values are listed but not rounded by the script. The error bounds are approximate white noise bounds, \(0 \pm 2/\sqrt{n}\); no other option is given.

References

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

Examples

Run this code
# NOT RUN {
acf1(rnorm(100))
acf1(sarima.sim(ar=.9), pacf=TRUE)
# }

Run the code above in your browser using DataLab