1 constructionModelesLassoMLE = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,X,Y,seuil,tau,selected){
10 phi = array(0, dim = c(p,m,k,L))
11 rho = array(dim = c(m,m,k,L))
12 pi = array( dim = c(k,L))
13 lvraisemblance = array( dim = c(L,2))
15 for (lambdaIndex in 1:L){
17 a = selected[,1,lambdaIndex]
20 res_EM = EMGLLF(phiInit[a,,],rhoInit,piInit,gamInit,mini,maxi,gamma,0,X[,a],Y,tau)
21 phiLambda = res_EM$phi
22 rhoLambda = res_EM$rho
24 for (j in 1:length(a)){
25 phi[a[j],,,lambdaIndex] = phiLambda[j,,]
27 rho[,,,lambdaIndex] = rhoLambda
28 pi[,lambdaIndex] = piLambda
32 b = A2[j,2:end,lambdaIndex]
35 phi[A2[j,1,lambdaIndex],b,,lambdaIndex] = 0.0
37 c = A1[j,2:end,lambdaIndex]
39 dimension = dimension + length(c)
42 #on veut calculer l'EMV avec toutes nos estimations
46 delta = Y[i,]*rho[,,r,lambdaIndex] - X[i,a]*phi[a,,r,lambdaIndex]
47 densite[i,lambdaIndex] = densite[i,lambdaIndex] + pi[r,lambdaIndex]*det(rho[,,r,lambdaIndex])/(sqrt(2*base::pi))^m*exp(-delta %*% delta/2.0)
51 lvraisemblance(lambdaIndex,1) = sum(log(densite[,lambdaIndex]))
52 lvraisemblance(lambdaIndex,2) = (dimension+m+1)*k-1