searchVarReg | R Documentation |
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.
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(...),
...
)
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 |
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 |
maxknots.m |
Integer indicating the maximum number of internal knots to be fit in the mean model. Default is |
maxknots.v |
Integer indicating the maximum number of internal knots to be fit in the variance model. Default is |
degree |
The degree of the splines fit in the mean and variance. Default is |
mono.var |
Text to indicate whether the variance model is monotonic (only applied to 'linear' or
semi-parametric variance models). Default is " |
selection |
Text to indicate which information criteria is to be used for the selection of the
best model. Choices are " |
print.it |
Logical to indicate whether to print progress from each model as the models are
performed. Default is |
control |
list of control parameters. See |
... |
arguments to be used to form the default control argument if it is not supplied directly |
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.
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).
semiVarReg
, VarReg.control
data(mcycle)
### not run
### find<-searchVarReg(mcycle$accel, mcycle$times, maxknots.v=3, maxknots.m=3,
### selection="HQC", maxit=10000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.