X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=R%2FindicesSelection.R;h=7835430f3ad8c763d7c18b830fdb0f070ee0b6e8;hb=c3bc47052f3ccb659659c59a82e9a99ea842398d;hp=04454069eff90e8d7a5491b619b046b5429d922b;hpb=d1531659214edd6eaef0ac9ec835455614bba16c;p=valse.git diff --git a/R/indicesSelection.R b/R/indicesSelection.R index 0445406..7835430 100644 --- a/R/indicesSelection.R +++ b/R/indicesSelection.R @@ -1,36 +1,36 @@ -#' Construct the set of relevant indices +#' Construct the set of relevant indices -> ED: je crois que cette fonction n'est pas utile #' #' @param phi regression matrix, of size p*m #' @param thresh threshold to say a cofficient is equal to zero #' #' @return a list with A, a matrix with relevant indices (size = p*m) and B, a -#' matrix with irrelevant indices (size = p*m) +#' matrix with irrelevant indices (size = p*m) #' @export indicesSelection = function(phi, thresh = 1e-6) { - dim_phi = dim(phi) - p = dim_phi[1] - m = dim_phi[2] - - A = matrix(0, p, m) - B = matrix(0, p, m) - - for(j in 1:p) - { - cpt1 = 0 - cpt2 = 0 - for(mm in 1:m) - { - if(max(phi[j,mm,]) > thresh) - { - cpt1 = cpt1 + 1 - A[j,cpt] = mm - } else - { - cpt2 = cpt2+1 - B[j, cpt2] = mm - } - } - } - return (list(A=A,B=B)) + dim_phi = dim(phi) + p = dim_phi[1] + m = dim_phi[2] + + A = matrix(0, p, m) + B = matrix(0, p, m) + + for(j in 1:p) + { + cpt1 = 0 + cpt2 = 0 + for(mm in 1:m) + { + if(max(phi[j,mm,]) > thresh) + { + cpt1 = cpt1 + 1 + A[j,cpt] = mm + } else + { + cpt2 = cpt2+1 + B[j, cpt2] = mm + } + } + } + return (list(A=A,B=B)) }