|
|
@ -1,43 +1,15 @@
|
|
|
|
m.item5=mean(s$item5),m.item6=mean(s$item6),m.item7=mean(s$item7))
|
|
|
|
beta.same.sign.truebeta.p=mean(beta.same.sign.truebeta.p),
|
|
|
|
} else {
|
|
|
|
beta.same.sign.truebeta.signif.p=mean(beta.same.sign.truebeta.p[num.reject])
|
|
|
|
a <- data.frame(m.item1_1=mean(s$item1_1),m.item1_2=mean(s$item1_2),m.item1_3=mean(s$item1_3),
|
|
|
|
|
|
|
|
m.item2_1=mean(s$item2_1),m.item2_2=mean(s$item2_2),m.item2_3=mean(s$item2_3),
|
|
|
|
|
|
|
|
m.item3_1=mean(s$item3_1),m.item3_2=mean(s$item3_2),m.item3_3=mean(s$item3_3),
|
|
|
|
|
|
|
|
m.item4_1=mean(s$item4_1),m.item4_2=mean(s$item4_2),m.item4_3=mean(s$item4_3),
|
|
|
|
|
|
|
|
m.item5_1=mean(s$item5_1),m.item5_2=mean(s$item5_2),m.item5_3=mean(s$item5_3),
|
|
|
|
|
|
|
|
m.item6_1=mean(s$item6_1),m.item6_2=mean(s$item6_2),m.item6_3=mean(s$item6_3),
|
|
|
|
|
|
|
|
m.item7_1=mean(s$item7_1),m.item7_2=mean(s$item7_2),m.item7_3=mean(s$item7_3)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
zz <- substr(scenario,start=0,stop=nchar(scenario)-4)
|
|
|
|
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
|
|
|
|
scenario.type=substr(zz,start=nchar(zz),stop=nchar(zz)),
|
|
|
|
|
|
|
|
N=substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)),
|
|
|
|
|
|
|
|
J=unique(s$J),
|
|
|
|
|
|
|
|
M=unique(s$M),
|
|
|
|
|
|
|
|
eff.size=unique(s$eff.size),
|
|
|
|
|
|
|
|
nb.dif=unique(s$nb.dif),
|
|
|
|
|
|
|
|
dif.size=unique(s$dif.size)
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
z <- data.frame(m.beta=mean(s$beta),
|
|
|
|
|
|
|
|
se.empirical.beta=sd(s$beta),
|
|
|
|
|
|
|
|
se.analytical.beta=mean(s$se.beta),
|
|
|
|
|
|
|
|
m.low.ci.beta=mean(s$low.ci.beta),
|
|
|
|
|
|
|
|
m.high.ci.beta=mean(s$high.ci.beta),
|
|
|
|
|
|
|
|
true.value.in.ci.p=mean(s$true.value.in.ci),
|
|
|
|
|
|
|
|
h0.rejected.p=mean(s$h0.rejected),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.p=mean(s$beta.same.sign.truebeta,na.rm=T),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.signif.p=mean(s[s$h0.rejected==1,]$beta.same.sign.truebeta,na.rm=T))
|
|
|
|
|
|
|
|
d <- cbind(b,a,z)
|
|
|
|
d <- cbind(b,a,z)
|
|
|
|
d$prop.
|
|
|
|
d$prop.
|
|
|
|
return(d)
|
|
|
|
return(d)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#### Compiled results
|
|
|
|
#### Compiled results
|
|
|
|
res.dat <- compile_simulation('1A_100')
|
|
|
|
res.dat.dif <- compile_simulation2('5A_100')
|
|
|
|
for (x in results[seq(2,length(results))]) {
|
|
|
|
for (x in results[seq(2,length(results))]) {
|
|
|
|
y <- compile_simulation(x)
|
|
|
|
y <- compile_simulation2(x)
|
|
|
|
res.dat <- bind_rows(res.dat,y)
|
|
|
|
res.dat.dif <- bind_rows(res.dat.dif,y)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#### Create data.frame
|
|
|
|
#### Create data.frame
|
|
|
|
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'))))
|
|
|
|
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'))))
|
|
|
@ -99,10 +71,11 @@ m.item7_1=mean(s$item7_1),m.item7_2=mean(s$item7_2),m.item7_3=mean(s$item7_3)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zz <- substr(scenario,start=0,stop=nchar(scenario)-4)
|
|
|
|
N <- ifelse(substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50","50",substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)))
|
|
|
|
|
|
|
|
zz <- ifelse(N=="50",substr(scenario,start=0,stop=nchar(scenario)-3),substr(scenario,start=0,stop=nchar(scenario)-4))
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
scenario.type=substr(zz,start=nchar(zz),stop=nchar(zz)),
|
|
|
|
scenario.type=substr(zz,start=nchar(zz),stop=nchar(zz)),
|
|
|
|
N=substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)),
|
|
|
|
N=N,
|
|
|
|
J=unique(s$J),
|
|
|
|
J=unique(s$J),
|
|
|
|
M=unique(s$M),
|
|
|
|
M=unique(s$M),
|
|
|
|
eff.size=unique(s$eff.size),
|
|
|
|
eff.size=unique(s$eff.size),
|
|
|
@ -132,6 +105,15 @@ res.dat[res.dat$scenario.type=='A','dif.size'] <- -res.dat[res.dat$scenario.type
|
|
|
|
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
|
|
|
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
|
|
|
res.dat[193:417,'nb.dif'] <- 2
|
|
|
|
res.dat[193:417,'nb.dif'] <- 2
|
|
|
|
res.dat[417:528,'nb.dif'] <- 3
|
|
|
|
res.dat[417:528,'nb.dif'] <- 3
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="B",] <- 0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="C" & res.dat$dif.size==0,] <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="C" & res.dat$dif.size!=0,] <- 0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="D" & res.dat$dif.size==0,] <- -0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="D" & res.dat$dif.size!=0,] <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="E" & res.dat$dif.size==0,] <- -0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="E" & res.dat$dif.size!=0,] <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="F",] <- -0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="G",] <- -0.4
|
|
|
|
View(res.dat)
|
|
|
|
View(res.dat)
|
|
|
|
res.dat.simple <- res.dat[,c(1:8,13,16:18)]
|
|
|
|
res.dat.simple <- res.dat[,c(1:8,13,16:18)]
|
|
|
|
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
|
|
|
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
|
|
@ -196,96 +178,6 @@ m.item7_1=mean(s$item7_1),m.item7_2=mean(s$item7_2),m.item7_3=mean(s$item7_3)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
N <- ifelse(substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50",50,substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)))
|
|
|
|
|
|
|
|
zz <- ifelse(N=="50",substr(scenario,start=0,stop=nchar(scenario)-3),substr(scenario,start=0,stop=nchar(scenario)-4))
|
|
|
|
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
|
|
|
|
scenario.type=substr(zz,start=nchar(zz),stop=nchar(zz)),
|
|
|
|
|
|
|
|
N=N,
|
|
|
|
|
|
|
|
J=unique(s$J),
|
|
|
|
|
|
|
|
M=unique(s$M),
|
|
|
|
|
|
|
|
eff.size=unique(s$eff.size),
|
|
|
|
|
|
|
|
nb.dif=unique(s$nb.dif),
|
|
|
|
|
|
|
|
dif.size=unique(s$dif.size)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
z <- data.frame(m.beta=mean(s$beta),
|
|
|
|
|
|
|
|
se.empirical.beta=sd(s$beta),
|
|
|
|
|
|
|
|
se.analytical.beta=mean(s$se.beta),
|
|
|
|
|
|
|
|
m.low.ci.beta=mean(s$low.ci.beta),
|
|
|
|
|
|
|
|
m.high.ci.beta=mean(s$high.ci.beta),
|
|
|
|
|
|
|
|
true.value.in.ci.p=mean(s$true.value.in.ci),
|
|
|
|
|
|
|
|
h0.rejected.p=mean(s$h0.rejected),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.p=mean(s$beta.same.sign.truebeta,na.rm=T),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.signif.p=mean(s[s$h0.rejected==1,]$beta.same.sign.truebeta,na.rm=T))
|
|
|
|
|
|
|
|
d <- cbind(b,a,z)
|
|
|
|
|
|
|
|
d$prop.
|
|
|
|
|
|
|
|
return(d)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#### Compiled results
|
|
|
|
|
|
|
|
res.dat <- compile_simulation('1A_100')
|
|
|
|
|
|
|
|
for (x in results[seq(2,length(results))]) {
|
|
|
|
|
|
|
|
y <- compile_simulation(x)
|
|
|
|
|
|
|
|
res.dat <- bind_rows(res.dat,y)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#### Create data.frame
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
#### Compiler function
|
|
|
|
|
|
|
|
compile_simulation <- function(scenario) {
|
|
|
|
|
|
|
|
name <- as.numeric(gsub("[^0-9.-]", "", substr(scenario,start=0,stop=2)))
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50" & name<=4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N50/scenario_',scenario,'.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50" & name>4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N50/scenario_',scenario,'.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="100" & name<=4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N100/scenario_',scenario,'.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="100" & name>4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N100/scenario_',scenario,'_nodif.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="200" & name<=4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N200/scenario_',scenario,'.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="200" & name>4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N200/scenario_',scenario,'_nodif.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="300" & name<=4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N300/scenario_',scenario,'.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="300" & name>4) {
|
|
|
|
|
|
|
|
s <- read.csv(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N300/scenario_',scenario,'_nodif.csv'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (unique(s$J)==4) {
|
|
|
|
|
|
|
|
if (unique(s$M)==2) {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1=mean(s$item1),m.item2=mean(s$item2),m.item3=mean(s$item3),m.item4=mean(s$item4))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1_1=mean(s$item1_1),m.item1_2=mean(s$item1_2),m.item1_3=mean(s$item1_3),
|
|
|
|
|
|
|
|
m.item2_1=mean(s$item2_1),m.item2_2=mean(s$item2_2),m.item2_3=mean(s$item2_3),
|
|
|
|
|
|
|
|
m.item3_1=mean(s$item3_1),m.item3_2=mean(s$item3_2),m.item3_3=mean(s$item3_3),
|
|
|
|
|
|
|
|
m.item4_1=mean(s$item4_1),m.item4_2=mean(s$item4_2),m.item4_3=mean(s$item4_3)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (unique(s$M)==2) {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1=mean(s$item1),m.item2=mean(s$item2),m.item3=mean(s$item3),m.item4=mean(s$item4),
|
|
|
|
|
|
|
|
m.item5=mean(s$item5),m.item6=mean(s$item6),m.item7=mean(s$item7))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1_1=mean(s$item1_1),m.item1_2=mean(s$item1_2),m.item1_3=mean(s$item1_3),
|
|
|
|
|
|
|
|
m.item2_1=mean(s$item2_1),m.item2_2=mean(s$item2_2),m.item2_3=mean(s$item2_3),
|
|
|
|
|
|
|
|
m.item3_1=mean(s$item3_1),m.item3_2=mean(s$item3_2),m.item3_3=mean(s$item3_3),
|
|
|
|
|
|
|
|
m.item4_1=mean(s$item4_1),m.item4_2=mean(s$item4_2),m.item4_3=mean(s$item4_3),
|
|
|
|
|
|
|
|
m.item5_1=mean(s$item5_1),m.item5_2=mean(s$item5_2),m.item5_3=mean(s$item5_3),
|
|
|
|
|
|
|
|
m.item6_1=mean(s$item6_1),m.item6_2=mean(s$item6_2),m.item6_3=mean(s$item6_3),
|
|
|
|
|
|
|
|
m.item7_1=mean(s$item7_1),m.item7_2=mean(s$item7_2),m.item7_3=mean(s$item7_3)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
N <- ifelse(substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50","50",substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)))
|
|
|
|
N <- ifelse(substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50","50",substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)))
|
|
|
|
zz <- ifelse(N=="50",substr(scenario,start=0,stop=nchar(scenario)-3),substr(scenario,start=0,stop=nchar(scenario)-4))
|
|
|
|
zz <- ifelse(N=="50",substr(scenario,start=0,stop=nchar(scenario)-3),substr(scenario,start=0,stop=nchar(scenario)-4))
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
@ -320,98 +212,24 @@ res.dat[res.dat$scenario.type=='A','dif.size'] <- -res.dat[res.dat$scenario.type
|
|
|
|
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
|
|
|
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
|
|
|
res.dat[193:417,'nb.dif'] <- 2
|
|
|
|
res.dat[193:417,'nb.dif'] <- 2
|
|
|
|
res.dat[417:528,'nb.dif'] <- 3
|
|
|
|
res.dat[417:528,'nb.dif'] <- 3
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="B",]$eff.size <- 0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="C" & res.dat$dif.size==0,]$eff.size <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="C" & res.dat$dif.size!=0,]$eff.size <- 0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="D" & res.dat$dif.size==0,]$eff.size <- -0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="D" & res.dat$dif.size!=0,]$eff.size <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="E" & res.dat$dif.size==0,]$eff.size <- -0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="E" & res.dat$dif.size!=0,]$eff.size <- 0.4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="F",]$eff.size <- -0.2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario.type=="G",]$eff.size <- -0.4
|
|
|
|
View(res.dat)
|
|
|
|
View(res.dat)
|
|
|
|
res.dat.simple <- res.dat[,c(1:8,13,16:18)]
|
|
|
|
res.dat.simple <- res.dat[,c(1:8,13,16:18)]
|
|
|
|
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
|
|
|
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
|
|
|
res.dat.simple
|
|
|
|
res.dat.simple
|
|
|
|
#### Create data.frame
|
|
|
|
##############################################################################
|
|
|
|
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'))))
|
|
|
|
########################### AGGREGATION DIF MATRICES #########################
|
|
|
|
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)[81:528]
|
|
|
|
|
|
|
|
#### Compiler function
|
|
|
|
|
|
|
|
compile_simulation2 <- function(scenario) {
|
|
|
|
|
|
|
|
name <- as.numeric(gsub("[^0-9.-]", "", substr(scenario,start=0,stop=2)))
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="50" & name>4) {
|
|
|
|
|
|
|
|
s <- read_excel(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N50/',scenario,'.xls'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="100" & name>4) {
|
|
|
|
|
|
|
|
s <- read_excel(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N100/',scenario,'.xls'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="200" & name>4) {
|
|
|
|
|
|
|
|
s <- read_excel(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N200/',scenario,'.xls'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario))=="300" & name>4) {
|
|
|
|
|
|
|
|
s <- read_excel(paste0('/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N300/',scenario,'.xls'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
J <- max(which(sapply(1:7,function(x) paste0('item',x) %in% colnames(s) | paste0('item',x,'_1') %in% colnames(s))))
|
|
|
|
|
|
|
|
M <- 1+sum(sapply(1:3,function(x) paste0('item1_',x) %in% colnames(s) ))
|
|
|
|
|
|
|
|
if (M==1) {M <- 2}
|
|
|
|
|
|
|
|
nb.dif <- max(which(sapply(1:3,function(x) paste0('dif',x) %in% colnames(s) | paste0('dif',x,'_1') %in% colnames(s))))
|
|
|
|
|
|
|
|
if (J==4) {
|
|
|
|
|
|
|
|
if (M==2) {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1=mean(s$item1),m.item2=mean(s$item2),m.item3=mean(s$item3),m.item4=mean(s$item4))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1_1=mean(s$item1_1),m.item1_2=mean(s$item1_2),m.item1_3=mean(s$item1_3),
|
|
|
|
|
|
|
|
m.item2_1=mean(s$item2_1),m.item2_2=mean(s$item2_2),m.item2_3=mean(s$item2_3),
|
|
|
|
|
|
|
|
m.item3_1=mean(s$item3_1),m.item3_2=mean(s$item3_2),m.item3_3=mean(s$item3_3),
|
|
|
|
|
|
|
|
m.item4_1=mean(s$item4_1),m.item4_2=mean(s$item4_2),m.item4_3=mean(s$item4_3)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (M==2) {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1=mean(s$item1),m.item2=mean(s$item2),m.item3=mean(s$item3),m.item4=mean(s$item4),
|
|
|
|
|
|
|
|
m.item5=mean(s$item5),m.item6=mean(s$item6),m.item7=mean(s$item7))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
a <- data.frame(m.item1_1=mean(s$item1_1),m.item1_2=mean(s$item1_2),m.item1_3=mean(s$item1_3),
|
|
|
|
|
|
|
|
m.item2_1=mean(s$item2_1),m.item2_2=mean(s$item2_2),m.item2_3=mean(s$item2_3),
|
|
|
|
|
|
|
|
m.item3_1=mean(s$item3_1),m.item3_2=mean(s$item3_2),m.item3_3=mean(s$item3_3),
|
|
|
|
|
|
|
|
m.item4_1=mean(s$item4_1),m.item4_2=mean(s$item4_2),m.item4_3=mean(s$item4_3),
|
|
|
|
|
|
|
|
m.item5_1=mean(s$item5_1),m.item5_2=mean(s$item5_2),m.item5_3=mean(s$item5_3),
|
|
|
|
|
|
|
|
m.item6_1=mean(s$item6_1),m.item6_2=mean(s$item6_2),m.item6_3=mean(s$item6_3),
|
|
|
|
|
|
|
|
m.item7_1=mean(s$item7_1),m.item7_2=mean(s$item7_2),m.item7_3=mean(s$item7_3)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
N <- ifelse(substr(scenario,start=nchar(scenario)-1,stop=nchar(scenario))=="50","50",substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)))
|
|
|
|
|
|
|
|
zz <- ifelse(N=="50",substr(scenario,start=0,stop=nchar(scenario)-3),substr(scenario,start=0,stop=nchar(scenario)-4))
|
|
|
|
|
|
|
|
eff.size <- unique(res.dat[res.dat$scenario==zz & res.dat$N==N,'eff.size'])
|
|
|
|
|
|
|
|
dif.size <- unique(res.dat[res.dat$scenario==zz & res.dat$N==N,'dif.size'])
|
|
|
|
|
|
|
|
b <- data.frame(scenario=zz,
|
|
|
|
|
|
|
|
scenario.type=substr(zz,start=nchar(zz),stop=nchar(zz)),
|
|
|
|
|
|
|
|
N=N,
|
|
|
|
|
|
|
|
J=J,
|
|
|
|
|
|
|
|
M=M,
|
|
|
|
|
|
|
|
eff.size=eff.size,
|
|
|
|
|
|
|
|
nb.dif=nb.dif,
|
|
|
|
|
|
|
|
dif.size=dif.size
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
true.value.in.ci <- eff.size <= s$beta+1.96*s$se_beta & eff.size >= s$beta-1.96*s$se_beta
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.p <- ifelse(rep(eff.size,nrow(s))==0,NA,(rep(eff.size,nrow(s))/s$beta)>0)
|
|
|
|
|
|
|
|
num.reject <- which((s$beta-1.96*s$se_beta)>0 | (s$beta+1.96*s$se_beta)<0)
|
|
|
|
|
|
|
|
z <- data.frame(m.beta=mean(s$beta),
|
|
|
|
|
|
|
|
se.empirical.beta=sd(s$beta),
|
|
|
|
|
|
|
|
se.analytical.beta=mean(s$se_beta),
|
|
|
|
|
|
|
|
m.low.ci.beta=mean(s$beta-1.96*s$se_beta),
|
|
|
|
|
|
|
|
m.high.ci.beta=mean(s$beta+1.96*s$se_beta),
|
|
|
|
|
|
|
|
true.value.in.ci.p=mean(true.value.in.ci),
|
|
|
|
|
|
|
|
h0.rejected.p=mean( (s$beta-1.96*s$se_beta)>0 | (s$beta+1.96*s$se_beta)<0 ),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.p=mean(beta.same.sign.truebeta.p),
|
|
|
|
|
|
|
|
beta.same.sign.truebeta.signif.p=mean(beta.same.sign.truebeta.p[num.reject])
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
d <- cbind(b,a,z)
|
|
|
|
|
|
|
|
d$prop.
|
|
|
|
|
|
|
|
return(d)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#### Compiled results
|
|
|
|
|
|
|
|
res.dat.dif <- compile_simulation2('5A_100')
|
|
|
|
|
|
|
|
for (x in results[seq(2,length(results))]) {
|
|
|
|
|
|
|
|
y <- compile_simulation2(x)
|
|
|
|
|
|
|
|
res.dat.dif <- bind_rows(res.dat.dif,y)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#### Create data.frame
|
|
|
|
#### Create data.frame
|
|
|
|
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'))))
|
|
|
|
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'))))
|
|
|
|
results2 <- c(sapply(10:20,function(x) paste0(x,c('A','B','C','D','E','F','G'))))
|
|
|
@ -502,11 +320,193 @@ res.dat.dif <- bind_rows(res.dat.dif,y)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
res.dat$bias <- res.dat$eff.size-res.dat$m.beta
|
|
|
|
res.dat$bias <- res.dat$eff.size-res.dat$m.beta
|
|
|
|
res.dat.dif$bias <- res.dat.dif$eff.size-res.dat.dif$m.beta
|
|
|
|
res.dat.dif$bias <- res.dat.dif$eff.size-res.dat.dif$m.beta
|
|
|
|
res.dat.dif
|
|
|
|
|
|
|
|
View(res.dat.dif)
|
|
|
|
View(res.dat.dif)
|
|
|
|
mean(res.dat.dif[res.dat.dif$N==50,]$bias)
|
|
|
|
##############################################################################
|
|
|
|
mean(res.dat.dif[res.dat.dif$N==50,]$bias,na.rm=T)
|
|
|
|
#----------------------------------------------------------------------------#
|
|
|
|
mean(res.dat.dif$bias,na.rm=T)
|
|
|
|
################################## RASCHPOWER ################################
|
|
|
|
mean(res.dat.dif[res.dat.dif$N!=50,]$bias,na.rm=T)
|
|
|
|
#----------------------------------------------------------------------------#
|
|
|
|
mean(res.dat[res.dat$N!=50,]$bias,na.rm=T)
|
|
|
|
##############################################################################
|
|
|
|
mean(res.dat[res.dat$N!=50,]$bias)
|
|
|
|
###### Puissance théorique
|
|
|
|
|
|
|
|
res.dat$theoretical.power <- 0
|
|
|
|
|
|
|
|
### Scénarios N=100
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==100,]$theoretical.power <- 0.1543
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==100,]$theoretical.power <- 0.1543
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==100,]$theoretical.power <- 0.4627
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==100,]$theoretical.power <- 0.4627
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==100,]$theoretical.power <- 0.1543
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==100,]$theoretical.power <- 0.4627
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==100,]$theoretical.power <- 0.4627
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==100,]$theoretical.power <- 0.1543
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==100,]$theoretical.power <- 0.4627
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'A') & res.dat$N==100,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==100,]$theoretical.power <- 0.2177
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==100,]$theoretical.power <- 0.2177
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==100,]$theoretical.power <- 0.6586
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==100,]$theoretical.power <- 0.6586
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==100,]$theoretical.power <- 0.2177
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==100,]$theoretical.power <- 0.6586
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==100,]$theoretical.power <- 0.6586
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==100,]$theoretical.power <- 0.2177
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==100,]$theoretical.power <- 0.6586
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'A') & res.dat$N==100,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==100,]$theoretical.power <- 0.1870
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==100,]$theoretical.power <- 0.1870
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==100,]$theoretical.power <- 0.5666
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==100,]$theoretical.power <- 0.5666
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==100,]$theoretical.power <- 0.1870
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==100,]$theoretical.power <- 0.5666
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==100,]$theoretical.power <- 0.5666
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==100,]$theoretical.power <- 0.1870
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==100,]$theoretical.power <- 0.5666
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'A') & res.dat$N==100,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==100,]$theoretical.power <- 0.2450
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==100,]$theoretical.power <- 0.2450
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==100,]$theoretical.power <- 0.7136
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==100,]$theoretical.power <- 0.7136
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==100,]$theoretical.power <- 0.2450
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==100,]$theoretical.power <- 0.7136
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==100,]$theoretical.power <- 0.7136
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==100,]$theoretical.power <- 0.2450
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==100,]$theoretical.power <- 0.7136
|
|
|
|
|
|
|
|
### Scénarios N=200
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==200,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==200,]$theoretical.power <- 0.2618
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==200,]$theoretical.power <- 0.2618
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==200,]$theoretical.power <- 0.7507
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==200,]$theoretical.power <- 0.7507
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==200,]$theoretical.power <- 0.2618
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==200,]$theoretical.power <- 0.7507
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==200,]$theoretical.power <- 0.7507
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==200,]$theoretical.power <- 0.2618
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==200,]$theoretical.power <- 0.7507
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'A') & res.dat$N==200,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==200,]$theoretical.power <- 0.3875
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==200,]$theoretical.power <- 0.3875
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==200,]$theoretical.power <- 0.9161
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==200,]$theoretical.power <- 0.9161
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==200,]$theoretical.power <- 0.3875
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==200,]$theoretical.power <- 0.9161
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==200,]$theoretical.power <- 0.9161
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==200,]$theoretical.power <- 0.3875
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==200,]$theoretical.power <- 0.9161
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'A') & res.dat$N==200,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==200,]$theoretical.power <- 0.3258
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==200,]$theoretical.power <- 0.3258
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==200,]$theoretical.power <- 0.8538
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==200,]$theoretical.power <- 0.8538
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==200,]$theoretical.power <- 0.3258
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==200,]$theoretical.power <- 0.8538
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==200,]$theoretical.power <- 0.8538
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==200,]$theoretical.power <- 0.3258
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==200,]$theoretical.power <- 0.8538
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'A') & res.dat$N==200,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==200,]$theoretical.power <- 0.4321
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==200,]$theoretical.power <- 0.4321
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==200,]$theoretical.power <- 0.9471
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==200,]$theoretical.power <- 0.9471
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==200,]$theoretical.power <- 0.4321
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==200,]$theoretical.power <- 0.9471
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==200,]$theoretical.power <- 0.9471
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==200,]$theoretical.power <- 0.4321
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==200,]$theoretical.power <- 0.9471
|
|
|
|
|
|
|
|
### Scénarios N=300
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==300,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==300,]$theoretical.power <- 0.3660
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==300,]$theoretical.power <- 0.3660
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==300,]$theoretical.power <- 0.8981
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==300,]$theoretical.power <- 0.8981
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==300,]$theoretical.power <- 0.3660
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==300,]$theoretical.power <- 0.8981
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==300,]$theoretical.power <- 0.8981
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==300,]$theoretical.power <- 0.3660
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==300,]$theoretical.power <- 0.8981
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'A') & res.dat$N==300,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==300,]$theoretical.power <- 0.5373
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==300,]$theoretical.power <- 0.5373
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==300,]$theoretical.power <- 0.9834
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==300,]$theoretical.power <- 0.9834
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==300,]$theoretical.power <- 0.5373
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==300,]$theoretical.power <- 0.9834
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==300,]$theoretical.power <- 0.9834
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==300,]$theoretical.power <- 0.5373
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==300,]$theoretical.power <- 0.9834
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'A') & res.dat$N==300,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==300,]$theoretical.power <- 0.4550
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==300,]$theoretical.power <- 0.4550
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==300,]$theoretical.power <- 0.9584
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==300,]$theoretical.power <- 0.9584
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==300,]$theoretical.power <- 0.4550
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==300,]$theoretical.power <- 0.9584
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==300,]$theoretical.power <- 0.9584
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==300,]$theoretical.power <- 0.4550
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==300,]$theoretical.power <- 0.9584
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'A') & res.dat$N==300,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==300,]$theoretical.power <- 0.5907
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==300,]$theoretical.power <- 0.5907
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==300,]$theoretical.power <- 0.9919
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==300,]$theoretical.power <- 0.9919
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==300,]$theoretical.power <- 0.5907
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==300,]$theoretical.power <- 0.9919
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==300,]$theoretical.power <- 0.9919
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==300,]$theoretical.power <- 0.5907
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==300,]$theoretical.power <- 0.9919
|
|
|
|
|
|
|
|
### Scénarios N=50
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==50,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==50,]$theoretical.power <- 0.1013
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==50,]$theoretical.power <- 0.1013
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==50,]$theoretical.power <- 0.2615
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==50,]$theoretical.power <- 0.2615
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==50,]$theoretical.power <- 0.1013
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==50,]$theoretical.power <- 0.2615
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==50,]$theoretical.power <- 0.2615
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==50,]$theoretical.power <- 0.1013
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==50,]$theoretical.power <- 0.2615
|
|
|
|
|
|
|
|
## Scénarios J=4 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'A') & res.dat$N==50,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==50,]$theoretical.power <- 0.1339
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==50,]$theoretical.power <- 0.1339
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==50,]$theoretical.power <- 0.3863
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==50,]$theoretical.power <- 0.3863
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==50,]$theoretical.power <- 0.1339
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==50,]$theoretical.power <- 0.3863
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==50,]$theoretical.power <- 0.3863
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==50,]$theoretical.power <- 0.1339
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==50,]$theoretical.power <- 0.3863
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=2
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'A') & res.dat$N==50,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==50,]$theoretical.power <- 0.1171
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==50,]$theoretical.power <- 0.1171
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==50,]$theoretical.power <- 0.3236
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==50,]$theoretical.power <- 0.3236
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==50,]$theoretical.power <- 0.1171
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==50,]$theoretical.power <- 0.3236
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==50,]$theoretical.power <- 0.3236
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==50,]$theoretical.power <- 0.1171
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==50,]$theoretical.power <- 0.3236
|
|
|
|
|
|
|
|
## Scénarios J=7 / M=4
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'A') & res.dat$N==50,]$theoretical.power <- 0.05
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==50,]$theoretical.power <- 0.1448
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==50,]$theoretical.power <- 0.1448
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==50,]$theoretical.power <- 0.4328
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==50,]$theoretical.power <- 0.4328
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==50,]$theoretical.power <- 0.1448
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==50,]$theoretical.power <- 0.4328
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==50,]$theoretical.power <- 0.4328
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==50,]$theoretical.power <- 0.1448
|
|
|
|
|
|
|
|
res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==50,]$theoretical.power <- 0.4328
|
|
|
|
|
|
|
|
### DIF scenarios
|
|
|
|
|
|
|
|
res.dat.dif$theoretical.power <- res.dat[81:nrow(res.dat),]$theoretical.power
|
|
|
|