Estimate Spectral Density of a Time Series from AR Fit

Share:

Description

Fits an AR model to x (or uses the existing fit) and computes (and by default plots) the spectral density of the fitted model.

Usage

1
2
spec.ar(x, n.freq, order = NULL, plot = TRUE, na.action = na.fail,
        method = "yule-walker", ...)

Arguments

x

A univariate (not yet:or multivariate) time series or the result of a fit by ar.

n.freq

The number of points at which to plot.

order

The order of the AR model to be fitted. If omitted, the order is chosen by AIC.

plot

Plot the periodogram?

na.action

NA action function.

method

method for ar fit.

...

Graphical arguments passed to plot.spec.

Value

An object of class "spec". The result is returned invisibly if plot is true.

Warning

Some authors, for example Thomson (1990), warn strongly that AR spectra can be misleading.

Note

The multivariate case is not yet implemented.

References

Thompson, D.J. (1990) Time series analysis of Holocene climate data. Phil. Trans. Roy. Soc. A 330, 601–616.

Venables, W.N. and Ripley, B.D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. (Especially page 402.)

See Also

ar, spectrum.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.