carxSelect: Select a 'carx' model by the AIC

Description Usage Arguments Value Examples


This function selects the carx model which minimizes the AIC among a set of carx models 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 inclusive. If 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 values where 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 2) fitted which is the fitted object of the selected model.


carxSelect(formulas,, data = list(), detect.outlier = F, ...)



a regression formula or a list of regression formulas.

the maximal AR order.


a CenTS object containing the data and censored information.


logical to specify whether outlier detection is performed (and incorporating in the carx model any found additive outliers) before computing the AIC for a model. Default = FALSE.


other arguments to be supplied, if not null, it will be called with the selected model and data. Examples include CI.compute=TRUE, which will cause the function to re-estimate the selected model with the confidence intervals computed, as in the selection part, no confidence interval is computed.


a list consisting of:

  • fitted the fitted CARX object of the model with the smallest AIC.

  • aicMat the matrix of AIC where rows correspond to the model formulas and columns correspond to the AR orders.


dataSim <- carxSimCenTS(nObs=100)
fmls <- list(M1=y~X1,M2=y~X1+X2,M3=y~X1+X2-1)
## Not run: cs = carxSelect(y~X1,,data=dataSim)
## Not run: cs = carxSelect(formulas=fmls,,data=dataSim)
## Not run: 
  #To compute confidence intervals for the selected model, call with CI.compute=TRUE.
  cs = carxSelect(formulas=fmls,,data=dataSim,CI.compute=TRUE)

## End(Not run)

Search within the carx package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.