"AR" for full AR(p) or "ARp"/"ARz" corresponding to subset models
Criterion
default is "BIC" for order selection and "BICq" for subset selection.
Options: "AIC", "BIC", "UBIC", "EBIC", "BICq" and "GIC".
Best
final number of models to be selected
Candidates
number of models initially selected using the approximate criterion
t
tuning parameter, EBIC, BICq, GIC
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.
The UBIC and EBIC developed by Chen and Chen (2007) are an extension of the
BIC criterion for subset selection. In the non-subset case UBIC is equivalent to BIC.
The EBIC using a tuning parameter, G, where 0 <= G <= 1.
The BICq takes a tuning parameter, Q, where 0 < Q < 1.
The GIC takes a tuning parameter, p, where 0<p<0.25.
Value
When code{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 code{Best} >1.
If ARModel = "AR", a matrix is return whose first column shows p and
second AIC or BIC.
Otherwise for subset selection, the result is a list with q components, where q=BEST.
When Criterion = "UBIC", the components in this list are:
p
lags present, a 0 indicates the null model
UBIC
exact UBIC
similarly for the AIC/BIC case.
The components are arranged in order of the criterion used.
When ARModel = "ARp" or "ARz", 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 and Y. Zhang
References
McLeod, A.I. and Zhang, Y. (2006).
Partial Autocorrelation Parameterization for Subset Autoregression.
Journal of Time Series Analysis, 27, 599-612.
Chen, J. and Chen, Z. (2008).
Extended Bayesian Information Criteria for Model Selection with Large Model Space.
Biometrika.
See Also
plot.Selectmodel,
PacfPlot,
PacfPlot,
FitAR
Examples
#Example 1: Find an ARp subset model for lynx data using BIC
z<-log(lynx)
out<-SelectModel(z, ARModel="ARp", Criterion="BIC", Best=5)
plot(out)
#
#Example 2: Find an ARz subset model for lynx data using BIC
out<-SelectModel(z, ARModel="ARz", Criterion="BIC", Best=5)
plot(out)
#
#Example 3: Select an AR(p) model
out<-SelectModel(z, ARModel="AR", Criterion="BIC", Best=5)
out
plot(out)
out<-SelectModel(z, ARModel="AR", Criterion="BIC", Best=1)
#
#Example 4: Fit subset models to lynx series
z<-log(lynx)
#requires library leaps. Should be automatically when FitAR package is loaded.
#first fit ARp
pvec <- SelectModel(z, lag.max=11, ARModel="ARp", Criterion="AIC", Best=1)
ans1 <- FitAR(z, pvec, ARModel="ARp", MLEQ=FALSE)
#now fit ARz
pvec <- SelectModel(z, lag.max=11, ARModel="ARz", Criterion="AIC", Best=1)
ans2<-FitAR(z, pvec, ARModel="ARz")
#compare
summary(ans1)
summary(ans2)
#Use UBIC
pvec <- SelectModel(z, ARModel="ARp",lag.max=11,Best=1)
ans3<-FitAR(z, pvec, ARModel="ARp")
pvec <- SelectModel(z, ARModel="ARz",lag.max=11,Best=1)
ans4<-FitAR(z, pvec, ARModel="ARz")
#compare
summary(ans3)
summary(ans4)
#
#Example 5: lynx data subset AR models
#The AIC and BIC choose the same models as the GIC with t=0.1 and t=0.01 respectively.
#An even more parsimonious model is chosen with t=0.001
SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.1)
SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.01)
SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.001)
ans<-SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=3, Candidates=5, t=0.001)
plot(ans)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FitAR)
Loading required package: lattice
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FitAR/SelectModel.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SelectModel
> ### Title: Select Best AR, ARz or ARp Model
> ### Aliases: SelectModel
> ### Keywords: ts
>
> ### ** Examples
>
> #Example 1: Find an ARp subset model for lynx data using BIC
> z<-log(lynx)
> out<-SelectModel(z, ARModel="ARp", Criterion="BIC", Best=5)
> plot(out)
> #
> #Example 2: Find an ARz subset model for lynx data using BIC
> out<-SelectModel(z, ARModel="ARz", Criterion="BIC", Best=5)
> plot(out)
> #
> #Example 3: Select an AR(p) model
> out<-SelectModel(z, ARModel="AR", Criterion="BIC", Best=5)
> out
p BIC-Exact BIC-Approx
1 2 -132.15930 -187.9718
2 4 -129.06497 -185.6765
3 3 -129.02017 -188.1834
4 10 -117.79153 -188.1193
5 1 -45.77229 -191.0704
> plot(out)
> out<-SelectModel(z, ARModel="AR", Criterion="BIC", Best=1)
> #
> #Example 4: Fit subset models to lynx series
> z<-log(lynx)
> #requires library leaps. Should be automatically when FitAR package is loaded.
> #first fit ARp
> pvec <- SelectModel(z, lag.max=11, ARModel="ARp", Criterion="AIC", Best=1)
> ans1 <- FitAR(z, pvec, ARModel="ARp", MLEQ=FALSE)
> #now fit ARz
> pvec <- SelectModel(z, lag.max=11, ARModel="ARz", Criterion="AIC", Best=1)
> ans2<-FitAR(z, pvec, ARModel="ARz")
> #compare
> summary(ans1)
AR(11). LS Fit.
length of series = 114 , number of parameters = 9
loglikelihood = 91.44 , aic = -164.9 , bic = -140.3 , UBIC = -132.2
series mean = 6.68593287334462, rmse = 0.435181111622127, R^2 = 88.545%
> summary(ans2)
AR(11). MLE.
length of series = 114 , number of parameters = 8
loglikelihood = 90.156 , aic = -164.3 , bic = -142.4 , UBIC = -132.2
series mean = 6.68593287334462, rmse = 0.440072521200226, R^2 = 88.286%
> #Use UBIC
> pvec <- SelectModel(z, ARModel="ARp",lag.max=11,Best=1)
> ans3<-FitAR(z, pvec, ARModel="ARp")
> pvec <- SelectModel(z, ARModel="ARz",lag.max=11,Best=1)
> ans4<-FitAR(z, pvec, ARModel="ARz")
> #compare
> summary(ans3)
AR(11). LS Fit.
length of series = 114 , number of parameters = 8
loglikelihood = 90.988 , aic = -166 , bic = -144.1 , UBIC = -133.9
series mean = 6.68593287334462, rmse = 0.436969236982322, R^2 = 88.45%
> summary(ans4)
AR(11). MLE.
length of series = 114 , number of parameters = 6
loglikelihood = 86.45 , aic = -160.9 , bic = -144.5 , UBIC = -132.2
series mean = 6.68593287334462, rmse = 0.45449744239728, R^2 = 87.505%
> #
> #Example 5: lynx data subset AR models
> #The AIC and BIC choose the same models as the GIC with t=0.1 and t=0.01 respectively.
> #An even more parsimonious model is chosen with t=0.001
> SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.1)
[1] 1 2 3 4 9 10 11
> SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.01)
[1] 1 2 4 10 11
> SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=1, Candidates=5, t=0.001)
[1] 1 2 9 12
> ans<-SelectModel(z, lag.max=15, ARModel="ARp", Criterion="GIC", Best=3, Candidates=5, t=0.001)
> plot(ans)
>
>
>
>
>
> dev.off()
null device
1
>