View source: R/plotArmaTrueacf.R
plotArmaTrueacf | R Documentation |
Compute the roots and theoretical ACF corresponding to an ARMA model
plotArmaTrueacf(object, lag.max = 20, pacf = FALSE, plot = TRUE,
xlab = "lag", ylab = c("ACF", "PACF")[1+pacf],
ylim = c(-1, 1) * max(ACF), type = "h",
complex.eps = 1000 * .Machine[["double.neg.eps"]], ...)
object |
either a numeric vector or a list with components 'ar' and 'ma'. If 'object' is numeric, it is interpreted as a model with no 'ma' part. |
lag.max |
the maximum number of lags for which to calculate the ACF or PACF. |
pacf |
logical. Should the partial autocorrelations be returned? |
plot |
logical. Should the ACF (or PACF) be plotted? |
xlab , ylab , ylim , type |
arguments for 'plot' |
complex.eps |
a small positive number used to identify complex conjugates: Let 'roots' = the vector of p roots of the characteristic polynomial of the autoregressive part of 'object'. This is used by 'findConjugates': x[i] and x[j] are considered conjugate if their relative difference exceeds complex.eps but the relative difference of their conjugates is less than complex.eps. We use 'solve' in the 'polynom' package, because it was substially more accurate for cases we tested in R 2.6.0 than 'polyroot'. |
... |
optional arguments passed to 'plot'. |
1. Compute and test stationarity. An ARMA process is stationary if all the roots of its AR component lie inside the unit circle (Box and Jenkins, 1970). If the process is not stationary, a warning is issued, and no plot is produced.
2. Compute and plot the theoretical ACF.
3. Analyze periodicity of any complex roots
a list with the following components
roots |
a complex vector of the roots sorted by modulus and sign of the immaginary part. |
acf , pacf |
a named numeric vector of the estimated ACF (or PACF of 'pacf = TRUE'). |
periodicity |
a data.frame with one row for each complex conjugate pair of roots and columns 'damping' and 'period'. |
https://faculty.chicagobooth.edu/ruey-s-tsay/teaching
George E. P. Box and Gwilym M. Jenkins (1970) Time Series Analysis, Forecasting and Control (Holden-Day, sec. 3.4.1. Stationarity and invertibility properties of Mixed autoregressive-moving average processes)
Ruey Tsay (2005) Analysis of Financial Time Series, 2nd ed. (Wiley, ch. 2)
solve.polynomial
,
ARMAacf
# Tsay, Figure 2.3
op <- par(mfcol = c(1, 2))
plotArmaTrueacf(.8, lag.max = 8)
title("(a)")
plotArmaTrueacf(-.8, lag.max = 8)
title("b")
par(op)
# Tsay, Figure 2.4
op <- par(mfrow = c(2,2))
plotArmaTrueacf(c(1.2, -.35))
title("(a)")
plotArmaTrueacf(c(.6, -.4))
title("(b)")
plotArmaTrueacf(c(.2, .35))
title("(c)")
plotArmaTrueacf(c(-.2, .35))
title("(d)")
par(op)
# Tsay, Example 2.1
data(q.gnp4791)
(fit.ar3 <- ar(q.gnp4791, aic = FALSE, order = 3))
plotArmaTrueacf(fit.ar3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.