cv_FCnet.RdThis function is a wrapper around glmnetUtils::cva.glmnet(), which is
itself built around glmnet::cv.glmnet(). For extended documentation,
the readers are encouraged to consult the respective pages.
cv_FCnet() requires two objects at minimum: y is a vector or data.frame
with exactly one column, corresponding to the (behavioral) score to predict; x
is a data.frame or a list of lists with an entry named "Weights",
which includes the independent variables. x can be - and is meant to be -
one object created by reduce_featuresFC(), but this is not strictly necessary.
The crossvalidated lambda and alpha parameters are returned. For the model,
use the FCnetLOO() function to avoid overfitting.
Differently from glmnet::cv.glmnet(), here the
mean absolute error is minimized by default; you can change this parameter
directly in the function or by running optionsFCnet(optionsFCnet= "mse").
cv_FCnet( y, x, alpha = seq(0, 1, by = 0.1), lambda = rev(10^seq(-5, 5, length.out = 200)), parallelLOO = F, cv_Ncomp = NULL, cv_Ncomp_method = c("order", "R"), family = optionsFCnet("family"), type.measure = optionsFCnet("cv.type.measure"), intercept = optionsFCnet("intercept"), standardize = optionsFCnet("standardize"), thresh = optionsFCnet("thresh"), ... )
| y | The dependent variable, typically behavioral scores to predict. This can be a vector or a single data.frame column. |
|---|---|
| x | The independent variables, typically neural measures that have
been already summarised through data reduction techniques
(e.g. ICA, PCA): an object created by |
| alpha | Value(s) that bias the elastic net toward ridge regression (alpha== 0) or LASSO regression (alpha== 1). If a vector of alpha values is supplied, the value is optimized through crossvalidation. It defaults to a vector ranging from 0 to 1 with steps of 0.1. The crossvalidated alpha is returned. |
| lambda | Regularization parameter for the regression,
see |
| parallelLOO | If TRUE - recommended, but not the default - uses
|
| cv_Ncomp | Whether to crossvalidate the number of components or not. It defaults to NULL, but a vector can be supplied specifing the number (range) of components to test in the inner loops. |
| cv_Ncomp_method | Whether the number of components to optimize means components are ordered (e.g. according to the explained variance of neuroimaging data) or - somehow experimental - whether to use the N best components ranked according to their relationship (pearson's R) with y. |
| family | Defaults to "gaussian." Experimental support for "binomial" on the way. |
| intercept | whether to fit (TRUE) or not (FALSE) an intercept to the model. |
| standardize | Whether x must be standardized internally to glmnet. |
| thresh | Threshold for glmnet to stop converging to the solution. |
| ... | Other parameters passed to |
| cv.type.measure | The measure to minimize in crossvalidation inner loops.
Differently from |
The crossvalidated alpha and lambda parameters with the associated error.