carxSelect: Select a 'carx' model by the AIC

Description Usage Arguments Value Examples

View source: R/carx_select.R

Description

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 max.ar 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 mar.ar (after incorporation of any found outlier if outlier detection if enabled), and 2) fitted which is the fitted object of the selected model.

Usage

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

Arguments

formulas

a regression formula or a list of regression formulas.

max.ar

the maximal AR order.

data

a CenTS object containing the data and censored information.

detect.outlier

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.

Value

a carx object with an additional element selectionInfo which is a list consisting of the information about the selection, in particular, aicMat, the matrix of AIC where rows correspond to the model formulas and columns correspond to the AR orders.

Examples

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)

carx documentation built on May 2, 2019, 3:43 a.m.

Related to carxSelect in carx...