- print('Model selection')
- tableauRecap = tableauRecap[rowSums(tableauRecap[, 2:4])!=0,]
+
+ # List (index k) of lists (index lambda) of models
+ models_list <-
+ if (ncores_outer > 1)
+ parLapply(cl, kmin:kmax, computeModels)
+ else
+ lapply(kmin:kmax, computeModels)
+ if (ncores_outer > 1)
+ parallel::stopCluster(cl)
+
+ if (! requireNamespace("capushe", quietly=TRUE))
+ {
+ warning("'capushe' not available: returning all models")
+ return (models_list)
+ }
+
+ # Get summary "tableauRecap" from models
+ tableauRecap = do.call( rbind, lapply( models_list, function(models) {
+ #Pour un groupe de modeles (même k, différents lambda):
+ llh = matrix(ncol = 2)
+ for (l in seq_along(models))
+ llh = rbind(llh, models[[l]]$llh)
+ LLH = llh[-1,1]
+ D = llh[-1,2]
+ k = length(models[[1]]$pi)
+ cbind(LLH, D, rep(k, length(models)), 1:length(models))
+ } ) )
+ tableauRecap = tableauRecap[rowSums(tableauRecap[, 2:4])!=0,]