Update Comparaison_of_methods.rmd

Modification of LOCAL SCORE MC function and hypothesis test
This commit is contained in:
njulia1 2022-05-14 17:49:21 +02:00
parent 864fd506a1
commit 980d36c175
1 changed files with 23 additions and 26 deletions

View File

@ -357,23 +357,24 @@ plot_graph_distrib_score(distrib_score_theo, distrib_score_mc)
```{r}
LocalScoreMC <- function(lambda0, lambda1, NbSeq, T, X_seq, P_X, tbe0){
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
}
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)
}
```
@ -451,20 +452,16 @@ CompareMethods <- function(lambda0, lambda1, NbSeq, T, tau){
```
```{r}
NbSeq = 10**2
NbSeq = 10**4
T = 10
tau = 2
list_of_lambda = list()
list_of_lambda[[1]] = c(1, 3)
list_of_lambda[[2]] = c(1, 4)
list_of_lambda[[3]] = c(1, 5)
list_of_lambda[[4]] = c(2, 4)
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)
list_of_lambda[[2]] = c(2, 6)
list_of_lambda[[3]] = c(4, 7)
list_of_lambda[[4]] = c(2, 9)
i = 1
legend_list = c()