1 constructionModelesLassoMLE = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,
11 phi = array(0, dim=c(p,m,k,L))
12 rho = array(0, dim=c(m,m,k,L))
14 llh = matrix(0, L, 2) #log-likelihood
16 for(lambdaIndex in 1:L)
18 a = A1[,1,lambdaIndex]
23 res = EMGLLF(phiInit[a,,],rhoInit,piInit,gamInit,mini,maxi,gamma,0.,X[,a],Y,tau)
25 for (j in 1:length(a))
26 phi[a[j],,,lambdaIndex] = res$phi[j,,]
27 rho[,,,lambdaIndex] = res$rho
28 pi[,lambdaIndex] = res$pi
33 b = A2[j,2:dim(A2)[2],lambdaIndex]
36 phi[A2[j,1,lambdaIndex],b,,lambdaIndex] = 0.
37 c = A1[j,2:dim(A1)[2],lambdaIndex]
38 dimension = dimension + sum(c!=0)
41 #on veut calculer l'EMV avec toutes nos estimations
42 densite = matrix(0, nrow=n, ncol=L)
47 delta = Y[i,]%*%rho[,,r,lambdaIndex] - (X[i,a]%*%phi[a,,r,lambdaIndex]);
48 densite[i,lambdaIndex] = densite[i,lambdaIndex] + pi[r,lambdaIndex] *
49 det(rho[,,r,lambdaIndex])/(sqrt(2*base::pi))^m * exp(-tcrossprod(delta)/2.0)
52 llh[lambdaIndex,1] = sum(log(densite[,lambdaIndex]))
53 llh[lambdaIndex,2] = (dimension+m+1)*k-1
55 return (list("phi"=phi, "rho"=rho, "pi"=pi, "llh" = llh))