Plot Autocovariance or Autocorrelation

DESCRIPTION:
Plots autocorrelation, partial autocorrelation or autocovariance given a list created by acf or ar.

USAGE:
acf.plot(z, layout=c(nser,nser), conf.int=T, type="h", ask=F, ...)

REQUIRED ARGUMENTS:
z:
a list as returned by the function acf, including components acf and lag, or a list as returned by the function ar with component partialacf.

OPTIONAL ARGUMENTS:
layout:
vector of length two specifying the layout of the plots per page. The first number gives the number of rows and the second gives the number of columns. By default, the number of univariate series is used for each number.
conf.int:
if TRUE, add a band about the zero line representing an approximate 95% confidence interval.
type:
desired type of plot. Besides the default of "h" (high density), this could be "l" (lines), "p" (points), or "b" (both lines and points).
ask:
logical flag: if TRUE, the user will have to hit the return key between pages. This allows the user to inspect each graph when the graphics device does not stop automatically between pages.

SIDE EFFECTS:
produces a plot of the sample autocovariance, autocorrelation, or partial autocorrelation functions. If conf.int is TRUE, approximate 95% confidence limits about 0 will be added to the plot.

DETAILS:
The layout argument is used to create a matrix of plots, and a title for the entire figure is produced. The graphical parameters mfrow and mfcol are respected, that is, the layout argument gives the plots that are produced in each frame of the current mfrow (mfcol). Other graphical parameters (e.g. col, lty) can be given as arguments.

Since the individual plots are drawn using subplot, the axis coordinates are all relative (to a 1 by 1 square); hence, functions like locator or abline may do strange things. Use locator() to find out what the true coordinates are, if these are needed to add text, lines, or such.

The confidence interval is computed as 2/sqrt(n.used) where n.used is the number of nonmissing observations in the time series. The interval can only be provided when n.used is a component of z. Note that this interval is valid only if z$acf represents the correlation function or the partial autocorrelation function, it is meaningless when z$acf is the covariance function.


REFERENCES:
The chapter "Analyzing Time Series" of the S-PLUS Guide to Statistical and Mathematical Analysis.

SEE ALSO:
acf , ar .

EXAMPLES:
acf.plot(acf.lynx, conf.int=F)
acf.plot(bonds.ar <- ar(bonds.yield))
pacf.lynx <- acf(lynx, 36, "partial", plot=F)
acf.plot(pacf.lynx, conf.int=T, type="l")