cv.starnet {starnet} | R Documentation |
Model comparison
Description
Compares stacked elastic net, tuned elastic net, ridge and lasso.
Usage
cv.starnet(
y,
X,
family = "gaussian",
nalpha = 21,
alpha = NULL,
nfolds.ext = 10,
nfolds.int = 10,
foldid.ext = NULL,
foldid.int = NULL,
type.measure = "deviance",
alpha.meta = 1,
nzero = NULL,
intercept = NULL,
upper.limit = NULL,
unit.sum = NULL,
...
)
Arguments
y |
response:
numeric vector of length |
X |
covariates:
numeric matrix with |
family |
character "gaussian", "binomial" or "poisson" |
nalpha |
number of |
alpha |
elastic net mixing parameters:
vector of length |
nfolds.ext , nfolds.int , foldid.ext , foldid.int |
number of folds ( |
type.measure |
loss function:
character "deviance", "class", "mse" or "mae"
(see |
alpha.meta |
meta-learner:
value between |
nzero |
number of non-zero coefficients:
scalar/vector including positive integer(s) or |
intercept |
settings for meta-learner: logical,
or |
upper.limit |
settings for meta-learner: logical,
or |
unit.sum |
settings for meta-learner: logical,
or |
... |
further arguments (not applicable) |
Value
List containing the cross-validated loss
(or out-of sample loss if nfolds.ext
equals two,
and foldid.ext
contains zeros and ones).
The slot meta
contains the loss from the stacked elastic net
(stack
), the tuned elastic net (tune
), ridge, lasso,
and the intercept-only model (none
).
The slot base
contains the loss from the base learners.
And the slot extra
contains the loss from the restricted
stacked elastic net (stack
), lasso, and lasso-like elastic net
(enet
),
with the maximum number of non-zero coefficients shown in the column name.
Examples
loss <- cv.starnet(y=y,X=X)