#' @param eps real, threshold to say the EM algorithm converges, by default = 1e-4
#' @param fast boolean to enable or not the C function call
#'
-#' @return A list (corresponding to the model collection) defined by (phi,rho,pi,LLF,S,affec):
-#' phi : regression mean for each cluster
-#' rho : variance (homothetic) for each cluster
-#' pi : proportion for each cluster
-#' LLF : log likelihood with respect to the training set
-#' S : selected variables indexes
+#' @return A list (corresponding to the model collection) defined by (phi,rho,pi,llh,S,affec):
+#' phi : regression mean for each cluster, an array of size p*m*k
+#' rho : variance (homothetic) for each cluster, an array of size m*m*k
+#' pi : proportion for each cluster, a vector of size k
+#' llh : log likelihood with respect to the training set
+#' S : selected variables indexes, an array of size p*m*k
#' affec : cluster affectation for each observation (of the training set)
#'
#' @export
#' @param fast boolean to enable or not the C function call
#'
#' @return A list (corresponding to the model collection) defined by (phi,LLF):
-#' phi : regression mean for each cluster
+#' phi : regression mean for each cluster, an array of size p*m*k
#' LLF : log likelihood with respect to the training set
#'
#' @export
#' @param eps threshold to stop EM algorithm
#' @param fast boolean to enable or not the C function call
#'
-#' @return the grid of regularization parameters
+#' @return the grid of regularization parameters for the Lasso estimator. The output is a vector with nonnegative values that are relevant
+#' to be considered as regularization parameter as they are equivalent to a 0 in the regression parameter.
#'
#' @export
computeGridLambda <- function(phiInit, rhoInit, piInit, gamInit, X, Y, gamma, mini,
#' @param fast TRUE to use compiled C code, FALSE for R code only
#' @param verbose TRUE to show some execution traces
#'
-#' @return a list with several models, defined by phi, rho, pi, llh
+#' @return a list with several models, defined by phi (the regression parameter reparametrized),
+#' rho (the covariance parameter reparametrized), pi (the proportion parameter is the mixture model), llh
+#' (the value of the loglikelihood function for this estimator on the training dataset). The list is given
+#' for several levels of sparsity, given by several regularization parameters computed automatically.
#'
#' @export
constructionModelesLassoMLE <- function(phiInit, rhoInit, piInit, gamInit, mini,
#' @param fast TRUE to use compiled C code, FALSE for R code only
#' @param verbose TRUE to show some execution traces
#'
-#' @return a list with several models, defined by phi, rho, pi, llh
+#' @return a list with several models, defined by phi (the regression parameter reparametrized),
+#' rho (the covariance parameter reparametrized), pi (the proportion parameter is the mixture model), llh
+#' (the value of the loglikelihood function for this estimator on the training dataset). The list is given
+#' for several levels of sparsity, given by several regularization parameters computed automatically,
+#' and several ranks (between rank.min and rank.max).
#'
#' @export
constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min, rank.max,
#' @param beta regression matrix, of size p*m*k
#' @param covY covariance for the response vector (of size m*m)
#'
-#' @return list with X and Y
+#' @return list with X (of size n*p) and Y (of size n*m)
#'
#' @export
generateXY <- function(n, prop, meanX, beta, covX, covY)
#' @param Y matrix of responses (of size n*m)
#' @param fast boolean to enable or not the C function call
#'
-#' @return a list with phiInit, rhoInit, piInit, gamInit
+#' @return a list with phiInit (the regression parameter reparametrized),
+#' rhoInit (the covariance parameter reparametrized), piInit (the proportion parameter is the
+#' mixture model), gamInit (the conditional expectation)
#'
#' @importFrom stats cutree dist hclust runif
#'
#' @param ncores Number or cores for parallel execution (1 to disable)
#' @param fast boolean to enable or not the C function call
#'
-#' @return a list of outputs, for each lambda in grid: selected,Rho,Pi
+#' @return a list, varying lambda in a grid, with selected (the indices of variables that are selected),
+#' Rho (the covariance parameter, reparametrized), Pi (the proportion parameter)
#'
#' @export
selectVariables <- function(phiInit, rhoInit, piInit, gamInit, mini, maxi, gamma,