diff --git a/RProject/.Rhistory b/RProject/.Rhistory index d6992b7..8493b04 100644 --- a/RProject/.Rhistory +++ b/RProject/.Rhistory @@ -1,7 +1,3 @@ -} -## create design matrix for covariate part -if(m>=1){ -designX <- -get_designX(X, DSF, m, I, q, n) ## create penalization matrix acoefs <- get_acoefs(RSM, DSF, m, I, q, n_sigma) ## update number of parameters to be optimized @@ -510,3 +506,7 @@ GPCMlasso(formula=cbind(item1,item2,item3,item4)~TT,data=aaaa,model="GPCM",contr GPCMlasso(formula=cbind(item1,item2,item3,item4)~TT,data=aaaa,model="GPCM",control = ctrl_GPCMlasso(lambda = 10000000,adaptive=F),DSF = F,cv=F) GPCMlasso(formula=cbind(item1,item2,item3,item4)~TT,data=aaaa,model="GRSM",control = ctrl_GPCMlasso(lambda = 10000,adaptive=F),DSF = F,cv=F) tam.mml(aaaa[,c("item1","item2","item3",'item4')],group=aaaa$TT) +wwwwww <- read.csv('/home/corentin/Documents/These/Recherche/Simulations/Analysis/RESALI/Detection_data/3A_200.csv') +table(wwwwww$dif.detect.1) +table(wwwwww$dif.detect.1)/400 +sum(table(wwwwww$dif.detect.1)/400) diff --git a/RProject/Scripts/resali_generate_newdata.R b/RProject/Scripts/resali_generate_newdata.R new file mode 100644 index 0000000..0105fb8 --- /dev/null +++ b/RProject/Scripts/resali_generate_newdata.R @@ -0,0 +1,84 @@ +## Liste des scenarios + +results <- c(sapply(1:4,function(x) paste0(x,c('A','B','C','D','E'))),sapply(5:9,function(x) paste0(x,c('A','B','C','D','E','F','G')))) + +results2 <- c(sapply(10:20,function(x) paste0(x,c('A','B','C','D','E','F','G')))) + +results <- c(sapply(c(50,100,200,300),function(x) paste0(results,'_',x))) + +results2 <- c(sapply(c(50,100,200,300),function(x) paste0(results2,'_',x))) + +results <- sort(results) + +results2 <- sort(results2) + +results <- c(results,results2) + +## Importer l'analyse resali pour chaque scenario + +for (r in results[21:length(results)]) { + cat('--------------------------------------------------------------------------\n') + cat(paste0(r,"\n")) + cat('--------------------------------------------------------------------------\n') + #### Importer les datas + scen <- as.numeric(gsub("[A,B,C,D,E,F,G,_]","",substr(r,0,3))) + if (substr(r,start=nchar(r)-1,stop=nchar(r))=="50") { + N <- 50 + } + if (substr(r,start=nchar(r)-2,stop=nchar(r))=="100") { + N <- 100 + } + if (substr(r,start=nchar(r)-2,stop=nchar(r))=="200") { + N <- 200 + } + if (substr(r,start=nchar(r)-2,stop=nchar(r))=="300") { + N <- 300 + } + if (scen<5) { + datt <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N',N,'/scenario_',r,'.csv')) + } + if (scen>=5) { + datt <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N',N,'/scenario_',r,'.csv')) + } + #### Importer l'analyse + analyse <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/RESALI/Detection/',r,".csv")) + #### Pour chaque replication + for (k in 1:1000) { + if (k%%100==0) { + cat(paste0("N = ",k," / 1000\n")) + } + datt[datt$replication==k,"dif.detect.1"] <- analyse[analyse$X==k,"dif.detect.1"] + datt[datt$replication==k,"dif.detect.2"] <- analyse[analyse$X==k,"dif.detect.2"] + datt[datt$replication==k,"dif.detect.3"] <- analyse[analyse$X==k,"dif.detect.3"] + datt[datt$replication==k,"dif.detect.4"] <- analyse[analyse$X==k,"dif.detect.4"] + datt[datt$replication==k,"dif.detect.unif.1"] <- analyse[analyse$X==k,"dif.detect.unif.1"] + datt[datt$replication==k,"dif.detect.unif.2"] <- analyse[analyse$X==k,"dif.detect.unif.2"] + datt[datt$replication==k,"dif.detect.unif.3"] <- analyse[analyse$X==k,"dif.detect.unif.3"] + datt[datt$replication==k,"dif.detect.unif.4"] <- analyse[analyse$X==k,"dif.detect.unif.4"] + if (scen==3 | scen==4 | scen>=13) { + datt[datt$replication==k,"dif.detect.5"] <- analyse[analyse$X==k,"dif.detect.5"] + datt[datt$replication==k,"dif.detect.6"] <- analyse[analyse$X==k,"dif.detect.6"] + datt[datt$replication==k,"dif.detect.7"] <- analyse[analyse$X==k,"dif.detect.7"] + datt[datt$replication==k,"dif.detect.unif.5"] <- analyse[analyse$X==k,"dif.detect.unif.5"] + datt[datt$replication==k,"dif.detect.unif.6"] <- analyse[analyse$X==k,"dif.detect.unif.6"] + datt[datt$replication==k,"dif.detect.unif.7"] <- analyse[analyse$X==k,"dif.detect.unif.7"] + } + } + datt[is.na(datt$dif.detect.1),"dif.detect.1"] <- "" + datt[is.na(datt$dif.detect.2),"dif.detect.2"] <- "" + datt[is.na(datt$dif.detect.3),"dif.detect.3"] <- "" + datt[is.na(datt$dif.detect.4),"dif.detect.4"] <- "" + datt[is.na(datt$dif.detect.unif.1),"dif.detect.unif.1"] <- "" + datt[is.na(datt$dif.detect.unif.2),"dif.detect.unif.2"] <- "" + datt[is.na(datt$dif.detect.unif.3),"dif.detect.unif.3"] <- "" + datt[is.na(datt$dif.detect.unif.4),"dif.detect.unif.4"] <- "" + if (scen==3 | scen==4 | scen>=13) { + datt[is.na(datt$dif.detect.5),"dif.detect.5"] <- "" + datt[is.na(datt$dif.detect.6),"dif.detect.6"] <- "" + datt[is.na(datt$dif.detect.7),"dif.detect.7"] <- "" + datt[is.na(datt$dif.detect.unif.5),"dif.detect.unif.5"] <- "" + datt[is.na(datt$dif.detect.unif.6),"dif.detect.unif.6"] <- "" + datt[is.na(datt$dif.detect.unif.7),"dif.detect.unif.7"] <- "" + } + write.csv(datt,paste0("/home/corentin/Documents/These/Recherche/Simulations/Analysis/RESALI/Detection_data/",r,".csv")) +}