From 6af1d4897dbab92a7be05068e0e15823378965d9 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Fri, 28 May 2021 12:01:01 +0200 Subject: [PATCH] Adjustments for CRAN upload --- pkg/R/EMGLLF.R | 12 ++++++------ pkg/R/EMGrank.R | 2 +- pkg/R/computeGridLambda.R | 3 ++- pkg/R/constructionModelesLassoMLE.R | 5 ++++- pkg/R/constructionModelesLassoRank.R | 6 +++++- pkg/R/generateXY.R | 2 +- pkg/R/initSmallEM.R | 4 +++- pkg/R/selectVariables.R | 3 ++- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pkg/R/EMGLLF.R b/pkg/R/EMGLLF.R index 1633821..4c31bb5 100644 --- a/pkg/R/EMGLLF.R +++ b/pkg/R/EMGLLF.R @@ -18,12 +18,12 @@ #' @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 diff --git a/pkg/R/EMGrank.R b/pkg/R/EMGrank.R index 9531ae4..8890e18 100644 --- a/pkg/R/EMGrank.R +++ b/pkg/R/EMGrank.R @@ -16,7 +16,7 @@ #' @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 diff --git a/pkg/R/computeGridLambda.R b/pkg/R/computeGridLambda.R index 3dae84c..f4073d0 100644 --- a/pkg/R/computeGridLambda.R +++ b/pkg/R/computeGridLambda.R @@ -14,7 +14,8 @@ #' @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, diff --git a/pkg/R/constructionModelesLassoMLE.R b/pkg/R/constructionModelesLassoMLE.R index fd0cd4d..692fbe1 100644 --- a/pkg/R/constructionModelesLassoMLE.R +++ b/pkg/R/constructionModelesLassoMLE.R @@ -17,7 +17,10 @@ #' @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, diff --git a/pkg/R/constructionModelesLassoRank.R b/pkg/R/constructionModelesLassoRank.R index 7a02967..a37a7a6 100644 --- a/pkg/R/constructionModelesLassoRank.R +++ b/pkg/R/constructionModelesLassoRank.R @@ -15,7 +15,11 @@ #' @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, diff --git a/pkg/R/generateXY.R b/pkg/R/generateXY.R index fde4b0f..6b811d6 100644 --- a/pkg/R/generateXY.R +++ b/pkg/R/generateXY.R @@ -9,7 +9,7 @@ #' @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) diff --git a/pkg/R/initSmallEM.R b/pkg/R/initSmallEM.R index cf31c63..3945322 100644 --- a/pkg/R/initSmallEM.R +++ b/pkg/R/initSmallEM.R @@ -7,7 +7,9 @@ #' @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 #' diff --git a/pkg/R/selectVariables.R b/pkg/R/selectVariables.R index 2d1c9b7..b8ea1a0 100644 --- a/pkg/R/selectVariables.R +++ b/pkg/R/selectVariables.R @@ -17,7 +17,8 @@ #' @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, -- 2.44.0