spec.ic | R Documentation |
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(xdata, BIC = FALSE, order.max = 30, main = NULL, plot = TRUE, detrend = FALSE, method=NULL, ...)
xdata |
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 |
plot 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 graphical arguments. |
Uses ar
to fit the best AR model based on pseudo AIC or BIC.
Using method='mle'
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
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.
The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
ar
, spec.ar
## Not run: # 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) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.