Cleaned up code

This commit is contained in:
2024-05-30 16:50:38 +02:00
parent 6086d74551
commit fd0d2de43f
50 changed files with 370 additions and 8057 deletions

View File

@ -17,6 +17,8 @@ lastChar <- function(str){
substr(str, nchar(str), nchar(str))
}
source(paste0(getwd(),"/functions/resali.R"))
##############################################################################
#----------------------------------------------------------------------------#
############################# ANALYSIS FUNCTIONS #############################

View File

@ -1,9 +1,5 @@
source(paste0(getwd(),"/functions/resali.R"))
##########################
# IGNORING DIF
@ -110,11 +106,6 @@ summary(res.dat.dif.resali[res.dat.dif.resali$nb.dif==0,"true.value.in.ci.p"])
summary(res.dat.dif.rosali[res.dat.dif.rosali$nb.dif==0,"true.value.in.ci.p"])
####################################################
# TABLES
####################################################
##########################
# TABLES NO DIF RECOVERY
##########################

View File

@ -16,6 +16,8 @@ lastChar <- function(str){
substr(str, nchar(str)-2, nchar(str))
}
source(paste0(getwd(),"/functions/resali.R"))
##############################################################################
#----------------------------------------------------------------------------#
############################# ANALYSIS FUNCTIONS #############################
@ -2058,26 +2060,26 @@ registerDoMC(5)
###################################### Scenario A
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_1A_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_2A_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_3A_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_4A_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5A_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6A_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7A_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8A_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9A_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10A_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11A_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12A_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13A_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14A_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15A_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16A_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17A_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18A_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19A_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20A_50.csv')
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_1A_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_2A_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_3A_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_4A_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5A_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6A_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7A_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8A_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9A_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10A_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11A_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12A_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13A_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14A_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15A_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16A_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17A_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18A_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19A_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20A_50.csv')
res <- pbmclapply(paste0("dat",1:20),function(x) replicate_pcm_analysis(get(x),eff.size = 0))
@ -2106,26 +2108,26 @@ write.csv(res[[20]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario B
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_1B_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_2B_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_3B_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_4B_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5B_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6B_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7B_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8B_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9B_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10B_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11B_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12B_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13B_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14B_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15B_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16B_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17B_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18B_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19B_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20B_50.csv')
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_1B_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_2B_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_3B_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_4B_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5B_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6B_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7B_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8B_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9B_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10B_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11B_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12B_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13B_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14B_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15B_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16B_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17B_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18B_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19B_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20B_50.csv')
res <- pbmclapply(paste0("dat",1:20),function(x) replicate_pcm_analysis(get(x),eff.size = 0.2))
@ -2154,26 +2156,27 @@ write.csv(res[[20]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario C
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_1C_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_2C_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_3C_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_4C_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5C_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6C_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7C_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8C_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9C_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10C_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11C_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12C_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13C_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14C_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15C_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16C_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17C_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18C_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19C_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20C_50.csv')
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_1C_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_2C_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_3C_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_4C_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5C_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6C_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7C_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8C_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9C_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10C_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11C_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12C_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13C_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14C_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15C_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16C_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17C_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18C_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19C_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20C_50.csv')
res <- pbmclapply(1:20,function(x) replicate_pcm_analysis(get(paste0("dat",x)),eff.size = ifelse(x>4,0.2,0.4)))
@ -2204,26 +2207,27 @@ write.csv(res[[20]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario D
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_1D_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_2D_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_3D_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_4D_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5D_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6D_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7D_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8D_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9D_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10D_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11D_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12D_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13D_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14D_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15D_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16D_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17D_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18D_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19D_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20D_50.csv')
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_1D_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_2D_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_3D_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_4D_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5D_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6D_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7D_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8D_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9D_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10D_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11D_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12D_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13D_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14D_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15D_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16D_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17D_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18D_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19D_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20D_50.csv')
res <- pbmclapply(1:20,function(x) replicate_pcm_analysis(get(paste0("dat",x)),eff.size = ifelse(x>4,0.4,-0.2)))
@ -2253,26 +2257,27 @@ write.csv(res[[20]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario E
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_1E_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_2E_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_3E_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_4E_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5E_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6E_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7E_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8E_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9E_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10E_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11E_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12E_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13E_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14E_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15E_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16E_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17E_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18E_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19E_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20E_50.csv')
dat1 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_1E_50.csv')
dat2 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_2E_50.csv')
dat3 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_3E_50.csv')
dat4 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50/scenario_4E_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5E_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6E_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7E_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8E_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9E_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10E_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11E_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12E_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13E_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14E_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15E_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16E_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17E_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18E_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19E_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20E_50.csv')
res <- pbmclapply(1:20,function(x) replicate_pcm_analysis(get(paste0("dat",x)),eff.size = ifelse(x>4,0.4,-0.4)))
@ -2299,22 +2304,22 @@ write.csv(res[[20]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario F
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5F_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6F_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7F_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8F_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9F_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10F_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11F_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12F_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13F_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14F_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15F_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16F_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17F_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18F_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19F_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20F_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5F_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6F_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7F_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8F_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9F_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10F_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11F_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12F_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13F_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14F_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15F_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16F_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17F_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18F_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19F_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20F_50.csv')
res <- pbmclapply(5:20,function(x) replicate_pcm_analysis(get(paste0("dat",x)),eff.size = -0.2))
@ -2337,22 +2342,22 @@ write.csv(res[[16]],'/home/corentin/Documents/These/Recherche/Simulations/Analys
###################################### Scenario G
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_5G_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_6G_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_7G_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_8G_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_9G_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_10G_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_11G_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_12G_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_13G_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_14G_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_15G_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_16G_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_17G_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_18G_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_19G_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/N50/scenario_20G_50.csv')
dat5 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_5G_50.csv')
dat6 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_6G_50.csv')
dat7 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_7G_50.csv')
dat8 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_8G_50.csv')
dat9 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_9G_50.csv')
dat10 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_10G_50.csv')
dat11 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_11G_50.csv')
dat12 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_12G_50.csv')
dat13 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_13G_50.csv')
dat14 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_14G_50.csv')
dat15 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_15G_50.csv')
dat16 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_16G_50.csv')
dat17 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_17G_50.csv')
dat18 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_18G_50.csv')
dat19 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_19G_50.csv')
dat20 <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50/scenario_20G_50.csv')
res <- pbmclapply(5:20,function(x) replicate_pcm_analysis(get(paste0("dat",x)),eff.size = -0.4))

View File

@ -4,6 +4,8 @@
#----------------------------------------------------------------------------#
##############################################################################
source(paste0(getwd(),"/functions/resali.R"))
generate_resali <- function(scenario=NULL,grp=NULL) {
scen <- as.numeric(gsub("[A,B,C,D,E,F,G,_]","",substr(scenario,0,3)))
if (substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50") {

View File

@ -0,0 +1,46 @@
###################################################
# Function: generate_diff_irt
# Generates item difficulty threshold matrix for
# IRT model simulation
###################################################
generate_diff_irt <- function(J=7,M=4) {
# if J=7, item 5. Else, item 3
if(J==7){
i <- 5
}
if(J==4){
i <- 3
}
difficulties = matrix(c(0), J,M-1)
rownames(difficulties)=paste("item",1:J)
colnames(difficulties)=paste("Moda", 1:(M-1))
for (j in 1:J){
difficulties[j,1] = qnorm(j/(J+1))
}
if (M>2) {
for (j in 1:J){
for (m in 2:(M-1)){
difficulties[j,m]= difficulties[j,1]+(m-1)*2/(M-2)
}
}
}
difficulties = difficulties-mean(difficulties)
return(difficulties)
}
###################################################
# GENERATE MATRIX FOR SIMULATION
###################################################
generate_diff_irt(J=4,M=2)
generate_diff_irt(J=4,M=4)
generate_diff_irt(J=7,M=2)
generate_diff_irt(J=7,M=4)

View File

@ -1,27 +0,0 @@
library(TAM)
pcm_analysis <- function(df=NULL,treatment='TT',irtmodel='PCM2',method='MML') {
nbitems <- sum(sapply(1:20,function(x) paste0('item',x)) %in% colnames(df))
resp <- df[,sapply(seq(1,nbitems),function(x) paste0('item',x))]
if (method=='MML') {
tam1 <- tam.mml(resp=resp,Y=df[,treatment],irtmodel = irtmodel,est.variance = T,verbose=F)
}
if (method=='JML') {
tam1 <- tam.jml(resp=resp,group=1+df[,treatment])
}
if (method!='MML' & method!='JML') {
stop('Invalid method. Please choose among MML or JML')
}
return(tam1)
}
dff <- read.csv(file = '/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N100/scenario_5A_100.csv')
dfff <- dff[dff$replication==1,]
facets <- dfff$TT
dfff$item4_noTT <- NA
dfff$item4_TT <- NA
dfff[dfff$TT==0,]$item4_noTT <- dfff[dfff$TT==0,"item4"]
dfff[dfff$TT==1,]$item4_TT <- dfff[dfff$TT==1,"item4"]
mml.mod <- tam.mml(resp=dfff[,c('item1','item2',"item3","item4_noTT",'item4_TT')],Y=dfff$TT,constraint='cases'
,irtmodel = "PCM2",est.variance = T,verbose=F)

View File

@ -1,89 +0,0 @@
##############################################################################
#----------------------------------------------------------------------------#
############################# DATA TRANSFORMATION ############################
#----------------------------------------------------------------------------#
##############################################################################
# Import ROSALI and RESALI
ros_mdc <- read_excel("/home/corentin/Documents/These/Recherche/Simulations/Analysis/ROSALI-DIF/N300/6A_300_original.xls")
res_mdc <- read_excel("/home/corentin/Documents/These/Recherche/Simulations/Analysis/RESALI/Results/N300/6A_300_original.xls")
# Perform MH
library(difR)
dat_mh <- read.csv('/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N300/scenario_6A_300.csv')[,c("item1","item2","item3","item4",'replication',"TT")]
det_mh <- c()
for (k in 1:1000) {
if (k%%1000==0) {
cat(paste0(k,'/1000\n'))
}
dat_mh_temp <- dat_mh[dat_mh$replication==k,c("item1",'item2',"item3","item4",'TT')]
aa <- difMH(Data=dat_mh_temp,group = "TT",focal.name = 0,exact=F)
det_mh <- c(det_mh,1:4 %in% aa$DIFitems)
}
# Create 1 line per item per replication in df
library(tidyr)
da <- as.data.frame(sapply(1:4, function(k) sapply(1:1000,function(x) k%in%ros_mdc[x,paste0("dif_detect_",1:4)])))
db <- as.data.frame(sapply(1:4, function(k) sapply(1:1000,function(x) k%in%res_mdc[x,paste0("dif_detect_",1:4)])))
dc <- as.data.frame(sapply(1:4, function(k) sapply(1:1000,function(x) k%in%res_mdc[x,paste0("real_dif_",1)])))
data_mdca <- data.frame(rosali=da)
data_mdca <- pivot_longer(data_mdca,cols=1:4)
data_mdcb <- data.frame(resali=db)
data_mdcb <- pivot_longer(data_mdcb,cols=1:4)
data_mdcc <- data.frame(real=dc)
data_mdcc <- pivot_longer(data_mdcc,cols=1:4)
data_mdc <- cbind(data_mdca,data_mdcb,data_mdcc)[,c(2,4,6)]
colnames(data_mdc) <- c("rosali","resali","real")
make_repl <- function(kk) {
b <- c()
for (k in kk) {
a <- rep(k,4)
b <- c(b,a)
}
return(b)
}
data_mdc$mh <- det_mh
data_mdc$replication <- make_repl(1:1000)
##############################################################################
#----------------------------------------------------------------------------#
########################### FIT DIF DETECTION MODEL ##########################
#----------------------------------------------------------------------------#
##############################################################################
# Fit TAN model
# Fit logistic model, stratified on replication
mod_glm <- glm(formula = real~rosali+resali,data = data_mdc[1:2000,],family = binomial())
data_valid <- data_mdc[2000:4000,]
data_valid$predict <- predict(mod_glm,newdata = data_valid)
roc_c <- pROC::roc(response=data_valid$real,predictor=data_valid$predict)
data_mdc$logit_pred <- predict(mod_glm,newdata = data_mdc)>=-0.6275167
perf_moreflex <- c()
for (k in 1:1000) {
dattt <- data_mdc[4*(k-1)+1:4,]
perf_moreflex <- c(perf_moreflex,all(rownames(dattt[dattt$real==TRUE,])%in%rownames(dattt[dattt$logit_pred==TRUE,])))
}
##############################################################################
#----------------------------------------------------------------------------#
######################## FIT UNIFORMITY DETECTION MODEL ######################
#----------------------------------------------------------------------------#
##############################################################################