| gesso.cv {gesso} | R Documentation | 
Cross-Validation
Description
Performs nfolds-fold cross-validation to tune hyperparmeters lambda_1 and lambda_2 for the gesso model.
Usage
gesso.cv(G, E, Y, C = NULL, normalize = TRUE, normalize_response = FALSE, grid = NULL,
         grid_size = 20, grid_min_ratio = NULL, alpha = NULL, family = "gaussian", 
         type_measure = "loss", fold_ids = NULL, nfolds = 4, 
         parallel = TRUE, seed = 42, tolerance = 1e-3, max_iterations = 5000, 
         min_working_set_size = 100, verbose = TRUE)
Arguments
| G | matrix of main effects of size  | 
| E | vector of environmental measurments | 
| Y | outcome vector. Set  | 
| C | matrix of confounders of size  | 
| normalize | 
 | 
| normalize_response | 
 | 
| grid | grid sequence for tuning hyperparameters, we use the same grid for  | 
| grid_size | specify  | 
| grid_min_ratio | parameter to determine  | 
| alpha | if  | 
| family | 
 | 
| type_measure | loss to use for cross-validation. Specity  | 
| fold_ids | option to input custom folds assignments | 
| tolerance | tolerance for the dual gap convergence criterion | 
| max_iterations | maximum number of iterations | 
| min_working_set_size | minimum size of the working set | 
| nfolds | number of cross-validation splits | 
| parallel | 
 | 
| seed | set random seed to control random folds assignments | 
| verbose | 
 | 
Value
A list of objects
| cv_result | a tibble with cross-validation results: averaged across folds loss and the number of non-zero coefficients for each value of ( 
 | 
| lambda_min | a tibble of optimal ( | 
| fit | list, return of the function gesso.fit on the full data | 
| grid | vector of values used for hyperparameters tuning | 
| full_cv_result | inner variables | 
Examples
data = data.gen()
tune_model = gesso.cv(data$G_train, data$E_train, data$Y_train, 
                      grid_size=20, parallel=TRUE, nfolds=3)
gxe_coefficients = gesso.coef(tune_model$fit, tune_model$lambda_min)$beta_gxe        
g_coefficients = gesso.coef(tune_model$fit, tune_model$lambda_min)$beta_g