From: Benjamin Auder Date: Fri, 14 Apr 2017 15:09:50 +0000 (+0200) Subject: cosmetics X-Git-Url: https://git.auder.net/doc/html/pieces/img/vendor/index.css?a=commitdiff_plain;h=0930b5d395ef0a48d1f97f88ee533c13d0962759;p=valse.git cosmetics --- diff --git a/pkg/R/EMGrank.R b/pkg/R/EMGrank.R index 7c0d91f..5eea322 100644 --- a/pkg/R/EMGrank.R +++ b/pkg/R/EMGrank.R @@ -48,7 +48,6 @@ matricize <- function(X) # R version - slow but easy to read .EMGrank_R = function(Pi, Rho, mini, maxi, X, Y, tau, rank) { - require(MASS) #matrix dimensions n = dim(X)[1] p = dim(X)[2] @@ -77,7 +76,7 @@ matricize <- function(X) if (length(Z_indice) == 0) next #U,S,V = SVD of (t(Xr)Xr)^{-1} * t(Xr) * Yr - s = svd( ginv(crossprod(matricize(X[Z_indice,]))) %*% + s = svd( MASS::ginv(crossprod(matricize(X[Z_indice,]))) %*% crossprod(matricize(X[Z_indice,]),matricize(Y[Z_indice,])) ) S = s$d #Set m-rank(r) singular values to zero, and recompose @@ -107,7 +106,7 @@ matricize <- function(X) } sumLogLLF2 = sumLogLLF2 + log(sumLLF1) } - + LLF = -1/n * sumLogLLF2 #update distance parameter to check algorithm convergence (delta(phi, Phi)) diff --git a/pkg/R/computeGridLambda.R b/pkg/R/computeGridLambda.R index 9d06aed..b295535 100644 --- a/pkg/R/computeGridLambda.R +++ b/pkg/R/computeGridLambda.R @@ -32,6 +32,5 @@ computeGridLambda = function(phiInit, rhoInit, piInit, gamInit, X, Y, for (j in 1:m) grid[i,j,] = abs(list_EMG$S[i,j,]) / (n*list_EMG$pi^gamma) } - grid = unique(grid) - sort(grid) + sort( unique(grid) ) } diff --git a/pkg/R/initSmallEM.R b/pkg/R/initSmallEM.R index bd5ce17..7ffbade 100644 --- a/pkg/R/initSmallEM.R +++ b/pkg/R/initSmallEM.R @@ -13,7 +13,7 @@ initSmallEM = function(k,X,Y, fast=TRUE) n = nrow(Y) m = ncol(Y) p = ncol(X) - nIte = 20 + nIte = 20 Zinit1 = array(0, dim=c(n,nIte)) betaInit1 = array(0, dim=c(p,m,k,nIte)) sigmaInit1 = array(0, dim = c(m,m,k,nIte))