Last chance! 50% off unlimited learning
Sale ends in
Fits an AR model to x
(or uses the existing fit) and computes
(and by default plots) the spectral density of the fitted model.
spec.ar(x, n.freq, order = NULL, plot = TRUE, na.action = na.fail,
method = "yule-walker", …)
A univariate (not yet:or multivariate) time series or the
result of a fit by ar
.
The number of points at which to plot.
The order of the AR model to be fitted. If omitted, the order is chosen by AIC.
Plot the periodogram?
NA
action function.
method
for ar
fit.
Graphical arguments passed to plot.spec
.
An object of class "spec"
.
The result is returned invisibly if plot
is true.
Some authors, for example Thomson (1990), warn strongly that AR spectra can be misleading.
Thompson, D.J. (1990). Time series analysis of Holocene climate data. Philosophical Transactions of the Royal Society of London Series A, 330, 601--616. http://www.jstor.org/stable/53609.
Venables, W.N. and Ripley, B.D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. (Especially page 402.)
# NOT RUN {
require(graphics)
spec.ar(lh)
spec.ar(ldeaths)
spec.ar(ldeaths, method = "burg")
spec.ar(log(lynx))
spec.ar(log(lynx), method = "burg", add = TRUE, col = "purple")
spec.ar(log(lynx), method = "mle", add = TRUE, col = "forest green")
spec.ar(log(lynx), method = "ols", add = TRUE, col = "blue")
# }
Run the code above in your browser using DataLab