Estimate Spectral Density of a Time Series from AR Fit
Fits an AR model to data and computes (and by default plots) the spectral density of the fitted model based on AIC (default) or BIC.
spec.ic(data, BIC = FALSE, order.max = 30, main = NULL, plot = TRUE, detrend = FALSE, method=NULL, ...)
data |
a univariate time series. |
BIC |
if TRUE, fit is based on BIC. If FALSE (default), fit is based on AIC. |
order.max |
maximum order of models to fit. Defaults to 30. |
main |
title. Defaults to name of series, method and chosen order. |
plot |
if TRUE (default) produces a graphic of the estimated AR spectrum. |
detrend |
if TRUE, detrends the data first. Default is FALSE. |
method |
method of estimation - a character string specifying the method to fit the model chosen from the following: "yule-walker", "burg", "ols", "mle", "yw". Defaults to "yule-walker". |
... |
additional arguments. |
Uses ar
to fit the best AR model based on pseudo AIC or BIC.
No likelihood is calculated unless method='mle'
is used, however, the
calculations will be slow. The minimum centered AIC and BIC values and the
spectral and frequency ordinates are returned silently.
[[1]] |
Matrix with columns: ORDER, AIC, BIC |
[[2]] |
Matrix with columns: freq, spec |
D.S. Stoffer
# AIC spec.ic(soi) spec.ic(sunspotz, method='burg', col=4) # BIC after detrending on log scale spec.ic(soi, BIC=TRUE, detrend=TRUE, log='y') # plot AIC and BIC without spectral estimate tsplot(0:30, spec.ic(soi, plot=FALSE)[[1]][,2:3], type='o', xlab='order', nxm=5)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.