Update Comparaison_of_methods.rmd
Modification of LOCAL SCORE MC function and hypothesis test
This commit is contained in:
parent
864fd506a1
commit
980d36c175
|
@ -356,24 +356,25 @@ plot_graph_distrib_score(distrib_score_theo, distrib_score_mc)
|
||||||
### 3.2. Local score calculation
|
### 3.2. Local score calculation
|
||||||
```{r}
|
```{r}
|
||||||
LocalScoreMC <- function(lambda0, lambda1, NbSeq, T, X_seq, P_X, tbe0){
|
LocalScoreMC <- function(lambda0, lambda1, NbSeq, T, X_seq, P_X, tbe0){
|
||||||
E = ComputeE(lambda0, lambda1)
|
E = ComputeE(lambda0, lambda1)
|
||||||
|
pvalue = c()
|
||||||
|
X = c()
|
||||||
|
min_X = min(X_seq)
|
||||||
|
max_X = max(X_seq)
|
||||||
|
NbSeq.NonNulles = 0
|
||||||
|
for (i in 1:NbSeq){
|
||||||
|
x = floor(E*log(dexp(tbe0[[i]], rate = lambda1)/dexp(tbe0[[i]], rate = lambda0)))
|
||||||
|
if (length(x)!=0){
|
||||||
|
X = c(X,x)
|
||||||
|
LS = localScoreC(x)$localScore[1]
|
||||||
|
daudin_result = daudin(localScore = LS, score_probabilities = P_X, sequence_length = length(x), sequence_min = min_X, sequence_max = max_X)
|
||||||
|
options(warn = -1) # Disable warnings print
|
||||||
|
pvalue = c(pvalue, daudin_result)
|
||||||
|
NbSeq.NonNulles = NbSeq.NonNulles + 1
|
||||||
|
|
||||||
pvalue = c()
|
}
|
||||||
X = c()
|
|
||||||
|
|
||||||
min_X = min(X_seq)
|
|
||||||
max_X = max(X_seq)
|
|
||||||
|
|
||||||
for (i in 1:NbSeq){
|
|
||||||
x = floor(E*log(dexp(tbe0[[i]], rate = lambda1)/dexp(tbe0[[i]], rate = lambda0)))
|
|
||||||
LS = localScoreC(x)$localScore[1]
|
|
||||||
|
|
||||||
daudin_result = daudin(localScore = LS, score_probabilities = P_X, sequence_length = length(x), sequence_min = min_X, sequence_max = max_X)
|
|
||||||
options(warn = -1) # Disable warnings print
|
|
||||||
|
|
||||||
pvalue = c(pvalue, daudin_result)
|
|
||||||
}
|
}
|
||||||
LS_H0=data.frame(num=1:NbSeq, pvalue_scan=pvalue, class=as.numeric(pvalue<0.05))
|
LS_H0=data.frame(num=1:NbSeq.NonNulles, pvalue_scan=pvalue, class=(pvalue<0.05)*1)
|
||||||
return(LS_H0)
|
return(LS_H0)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -451,20 +452,16 @@ CompareMethods <- function(lambda0, lambda1, NbSeq, T, tau){
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
NbSeq = 10**2
|
NbSeq = 10**4
|
||||||
T = 10
|
T = 10
|
||||||
tau = 2
|
tau = 2
|
||||||
|
|
||||||
list_of_lambda = list()
|
list_of_lambda = list()
|
||||||
list_of_lambda[[1]] = c(1, 3)
|
list_of_lambda[[1]] = c(1, 3)
|
||||||
list_of_lambda[[2]] = c(1, 4)
|
list_of_lambda[[2]] = c(2, 6)
|
||||||
list_of_lambda[[3]] = c(1, 5)
|
list_of_lambda[[3]] = c(4, 7)
|
||||||
list_of_lambda[[4]] = c(2, 4)
|
list_of_lambda[[4]] = c(2, 9)
|
||||||
list_of_lambda[[5]] = c(2, 5)
|
|
||||||
list_of_lambda[[6]] = c(2, 6)
|
|
||||||
list_of_lambda[[7]] = c(4, 5)
|
|
||||||
list_of_lambda[[8]] = c(4, 8)
|
|
||||||
list_of_lambda[[9]] = c(4, 10)
|
|
||||||
|
|
||||||
i = 1
|
i = 1
|
||||||
legend_list = c()
|
legend_list = c()
|
||||||
|
|
Loading…
Reference in New Issue