selection {FWDselect} | R Documentation |
q
variablesMain function for selecting the best subset of q variables. Note that the selection procedure can be used with lm, glm or gam functions.
selection(x, y, q, prevar = NULL, criterion = "deviance", method = "lm", family = "gaussian", seconds = FALSE, nmodels = 1, nfolds = 5, cluster = TRUE, ncores = NULL)
x |
A data frame containing all the covariates. |
y |
A vector with the response values. |
q |
An integer specifying the size of the subset of variables to be selected. |
prevar |
A vector containing the number of the best subset of
|
criterion |
The information criterion to be used.
Default is the deviance. Other functions provided
are the coefficient of determination ( |
method |
A character string specifying which regression method is used,
i.e., linear models ( |
family |
A description of the error distribution and link function to be
used in the model: ( |
seconds |
A logical value. By default, |
nmodels |
Number of secondary models to be returned. |
nfolds |
Number of folds for the cross-validation procedure, for
|
cluster |
A logical value. If |
ncores |
An integer value specifying the number of cores to be used
in the parallelized procedure. If |
Best model |
The best model. If |
Variable name |
Names of the variable. |
Variable number |
Number of the variables. |
Information criterion |
Information criterion used and its value. |
Prediction |
The prediction of the best model. |
Marta Sestelo, Nora M. Villanueva and Javier Roca-Pardinas.
library(FWDselect) data(diabetes) x = diabetes[ ,2:11] y = diabetes[ ,1] obj1 = selection(x, y, q = 1, method = "lm", criterion = "variance", cluster = FALSE) obj1 # second models obj11 = selection(x, y, q = 1, method = "lm", criterion = "variance", seconds = TRUE, nmodels = 2, cluster = FALSE) obj11 # prevar argument obj2 = selection(x, y, q = 2, method = "lm", criterion = "variance", cluster = FALSE) obj2 obj3 = selection(x, y, q = 3, prevar = obj2$Variable_numbers, method = "lm", criterion = "variance", cluster = FALSE)