Commit | Line | Data |
---|---|---|
f2a91208 | 1 | #' Construct the set of relevant indices -> ED: je crois que cette fonction n'est pas utile |
d1531659 | 2 | #' |
3 | #' @param phi regression matrix, of size p*m | |
4 | #' @param thresh threshold to say a cofficient is equal to zero | |
5 | #' | |
6 | #' @return a list with A, a matrix with relevant indices (size = p*m) and B, a | |
e166ed4e | 7 | #' matrix with irrelevant indices (size = p*m) |
d1531659 | 8 | #' @export |
9 | indicesSelection = function(phi, thresh = 1e-6) | |
10 | { | |
e166ed4e BA |
11 | dim_phi = dim(phi) |
12 | p = dim_phi[1] | |
13 | m = dim_phi[2] | |
14 | ||
15 | A = matrix(0, p, m) | |
16 | B = matrix(0, p, m) | |
17 | ||
18 | for(j in 1:p) | |
19 | { | |
20 | cpt1 = 0 | |
21 | cpt2 = 0 | |
22 | for(mm in 1:m) | |
23 | { | |
24 | if(max(phi[j,mm,]) > thresh) | |
25 | { | |
26 | cpt1 = cpt1 + 1 | |
27 | A[j,cpt] = mm | |
28 | } else | |
29 | { | |
30 | cpt2 = cpt2+1 | |
31 | B[j, cpt2] = mm | |
32 | } | |
33 | } | |
34 | } | |
35 | return (list(A=A,B=B)) | |
d1531659 | 36 | } |