SelectModel(FitAR)R Documentation

Select Best AR(p) or Subset AR(p) Using AIC

Description

The AIC or BIC criterion is used to select the best fitting AR or subset AR model. The result may be plotted using plot.

Usage

SelectModel(z, lag.max = 15, SubsetModel = c("n", "p", "z"), method = "AIC", Best = 3, Candidates = 5)

Arguments

z time series data
lag.max maximum order of autoregression
SubsetModel default is no subset. Alternatives are AR-phi or AR-zeta
method default is AIC otherise is BIC
Best number of models to be selected
Candidates number of models initially selected using the approximate criterion

Details

McLeod and Zhang (2006) outline an approximate AIC/BIC selection algorithm. This algorithm is a refinement of that method. The refinement consists of automatically look for the best k candidates, where k=Candidates. Then the exact likelihood is evaluated for all k candidates. Out of these k candidates, the best q = Best are then selected. This two-step procedure is needed because if k is too low, the approximate AIC/BIC rankings may not agree with the exact rankings. This strategy is used for model selection for AR, ARz and ARp models. A plot method is available to graph the output.

Value

When Best = 1, a vector is returned indicated the lag or lags included in the model. The null model is indicated by returning 0 for the lag. An object with class "Selectmodel" is returned when Best >1. If SubsetQ = FALSE, a matrix is return whose first column shows p and second AIC or BIC. Otherwise for subset select, the result is a list with q components, where q=BEST. When method="AIC", the components in this list are:

p
AIC

{exact AIC} Similarly when method="BIC", the second component is BIC.
The components are arranged in order of the AIC/BIC criterion.
When SubsetModel="p" or "z", an attribute "model" indicating "ARp" or "ARz" is included.

Warning

Setting Candidates too low can result in anomalous results. For example if Candidates=1, we find that the top ranking model may depend on how large Best is set. This phenomenon is due to the fact that among the best AIC/BIC models there is sometimes very little difference in their AIC/BIC scores. Since the initial ranking of the Candidates is done using the approximate likelihood, the final ranking using the exact likelihood may change.

Note

For white noise, the best model is the null model, containing no lags. This is indicating by setting the model order, p=0.

Author(s)

A.I. McLeod

References

McLeod, A.I. and Zhang, Y. (2006). Partial autocorrelation parameterization for subset autoregression. Journal of Time Series Analysis, 27, 599-612.

See Also

plot.Selectmodel, PacfPlot, PacfPlot, FitAR

Examples

#Example 1: find a ARp subset model for lynx data using BIC
z<-log(lynx)
out<-SelectModel(z, SubsetModel="p", method="BIC", Best=5)
plot(out)
#
#Example 2: find a ARz subset model for lynx data using BIC
out<-SelectModel(z, SubsetModel="z", method="BIC", Best=5)
plot(out)
#
#Example 3: Select AR(p) model
out<-SelectModel(z, method="BIC", Best=5)
out
plot(out)
#
#Example 4: Fit subset models to lynx series
z<-log(lynx)
#requires library leaps. Should be automatically when FitAR package is loaded.
pvec <- SelectModel(z, lag.max=11, SubsetModel="p", method="AIC", Best=1)
ans1 <- FitARLS(z, pvec)
pvec <- SelectModel(z, lag.max=11, SubsetModel="z", method="AIC", Best=1)
ans2<-FitAR(z, pvec)
summary(ans1)
summary(ans2)

[Package FitAR version 1.0 Index]