fix memory leaks on EMGLLF, test OK for EMGrank
[valse.git] / R / basicInitParameters.R
index 6090d0a..3583e68 100644 (file)
@@ -1,3 +1,13 @@
+#-----------------------------------------------------------------------
+#' Initialize the parameters in a basic way (zero for the conditional mean,
+#'     uniform for weights, identity for covariance matrices, and uniformly distributed forthe clustering)
+#' @param n sample size
+#' @param p number of covariates
+#' @param m size of the response
+#' @param k number of clusters
+#' @return list with phiInit, rhoInit,piInit,gamInit
+#' @export
+#-----------------------------------------------------------------------
 basic_Init_Parameters = function(n,p,m,k)
 {
        phiInit = array(0, dim=c(p,m,k))
@@ -14,5 +24,5 @@ basic_Init_Parameters = function(n,p,m,k)
                gamInit[i,R[i]] = 0.9
        gamInit = gamInit/sum(gamInit[1,])
 
-       return (list(phiInit, rhoInit, piInit, gamInit))
+       return (data = list(phiInit = phiInit, rhoInit = rhoInit, piInit = piInit, gamInit = gamInit))
 }