Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
The AIC/BIC/UBIC/EBIC/BICq criterion is used to select the best fitting AR or subset AR model.
When Best > 1, the result may be plotted using plot
.
1 | SelectModel(z, lag.max = 15, ARModel = c("AR", "ARz", "ARp"), Criterion = "default", Best = 3, Candidates = 5, t="default")
|
z |
time series data |
lag.max |
maximum order of autoregression |
ARModel |
"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 |
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.
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.
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.
For white noise, the best model is the null model, containing no lags. This is indicating by setting the model order, p=0.
A.I. McLeod and Y. Zhang
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.
plot.Selectmodel
,
PacfPlot
,
PacfPlot
,
FitAR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #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)
|
Loading required package: lattice
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
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
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%
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%
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%
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%
[1] 1 2 3 4 9 10 11
[1] 1 2 4 10 11
[1] 1 2 9 12
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.