searchVarReg: Searches for best semi parametric mean and variance...

View source: R/searchVarReg.R

searchVarRegR Documentation

Searches for best semi parametric mean and variance regression model

Description

searchVarReg performs multiple semi-parametric mean and variance regression models for a covariate of interest, in order to search for the optimal number of knots. The best model is chosen based on the information criterion of preference ("selection"). At the moment, this is only designed for a single covariate that is fit in both the mean and variance models.

Usage

searchVarReg(
  y,
  x,
  cens.ind = NULL,
  maxknots.m = 3,
  maxknots.v = 3,
  degree = 2,
  mono.var = c("none", "inc", "dec"),
  selection = c("AIC", "AICc", "HQC", "BIC"),
  print.it = FALSE,
  control = list(...),
  ...
)

Arguments

y

Vector containing outcome data. Must be no missing data and any censored values must be set to the limits of detection.

x

Vector containing the covariate data. Must be no missing data and same length as y.

cens.ind

Vector containing the censoring indicator, if applicable. There must be no missing data contained in the vector and this vector should be the same length as y. "0" values indicate uncensored data, "1" indicates right, or upper, censoring and "-1" indicates left, or lower, censoring. The default is NULL which indicates there is no censored data.

maxknots.m

Integer indicating the maximum number of internal knots to be fit in the mean model. Default is 3. (Note that the knots are placed equidistantly over x.)

maxknots.v

Integer indicating the maximum number of internal knots to be fit in the variance model. Default is 3. (Note that the knots are placed equidistantly over x.)

degree

The degree of the splines fit in the mean and variance. Default is 2.

mono.var

Text to indicate whether the variance model is monotonic (only applied to 'linear' or semi-parametric variance models). Default is "none" (no monotonic constraints). Options are "inc" for increasing or "dec" for decreasing. If the variance model is linear, the parameter space is constrained (positive for increasing and negative for decreasing). For semi-parametric variance models, the appropriate monotonic B splines are fit in the semi-parametric variance model.

selection

Text to indicate which information criteria is to be used for the selection of the best model. Choices are "AIC", "AICc", "BIC" and "HQC". Default is "AIC".

print.it

Logical to indicate whether to print progress from each model as the models are performed. Default is FALSE.

control

list of control parameters. See VarReg.control.

...

arguments to be used to form the default control argument if it is not supplied directly

Details

A matrix of models are performed, of increasing complexity. Mean models start at a zero mean model, then constant mean, linear, 0 internal knots, etc, up to a maximum internal knots as specified in maxknots.m. Variance models start at constant variance, linear variance, 0 internal knots, etc, up to max internal knots as specified in maxknots.v.

Note that this function can take some time to run, due to the number of models to be fit. A window will appear on windows based systems to show a progress bar for the function.

Value

searchVarReg returns an list, with the following components:

  • ll: a dataframe of the log-likelihoods from each of the models that have been fit.

  • AIC: a dataframe of the AIC from each of the models that have been fit. The parameters fit in the mean model are given in the columns, and the parameters in the variance are given in the rows.

  • AICc: a dataframe of the AIC-c from each of the models that have been fit.

  • BIC: a dataframe of the BIC from each of the models that have been fit.

  • HQC: a dataframe of the HQC from each of the models that have been fit.

  • best.model: an object of class VarReg (see semiVarReg) containing the output from the optimal model (that model within the specified models in the mean and variance with the lowest information criterion according to the criterion selected).

See Also

semiVarReg, VarReg.control

Examples

data(mcycle)
### not run
### find<-searchVarReg(mcycle$accel, mcycle$times, maxknots.v=3, maxknots.m=3,
### selection="HQC", maxit=10000)

VarReg documentation built on May 31, 2023, 8:44 p.m.