Select a carx model by the AIC
This function selects the
carx model which minimizes the AIC among a set of
defined by a set of formulas or a list of regression formulas with a maximal AR order.
The model specification is supplied by
formulas which can be either a formula or a list of formulas.
For each formula, the function will estimate the
carx models with the AR order
from 1 to
detect.outlier=TRUE, outlier detection will be performed for each combination of model
formula and AR order.
The function returns a
list which consists of: 1)
aicMat which is a matrix of AIC
each row contains the AICs of the model given by a specific regression formula with the AR order
ranging from 1 to
(after incorporation of any found outlier if outlier detection if enabled), and
fitted which is the fitted object of the selected model.
a regression formula or a list of regression formulas.
the maximal AR order.
logical to specify whether outlier detection is performed (and incorporating in
other arguments to be supplied, if not null, it will be called with the selected model and data.
a list consisting of:
fittedthe fitted CARX object of the model with the smallest AIC.
aicMatthe matrix of AIC where rows correspond to the model formulas and columns correspond to the AR orders.
1 2 3 4 5 6 7 8 9
dataSim <- carxSimCenTS(nObs=100) fmls <- list(M1=y~X1,M2=y~X1+X2,M3=y~X1+X2-1) ## Not run: cs = carxSelect(y~X1,max.ar=3,data=dataSim) ## Not run: cs = carxSelect(formulas=fmls,max.ar=3,data=dataSim) ## Not run: #To compute confidence intervals for the selected model, call with CI.compute=TRUE. cs = carxSelect(formulas=fmls,max.ar=3,data=dataSim,CI.compute=TRUE) ## End(Not run)