Added a few .ado (raschpower)
This commit is contained in:
@ -1,359 +1,3 @@
|
||||
View(res.dat)
|
||||
res.dat.simple <- res.dat[,c(1:7,12,15:17)]
|
||||
res.dat.simple
|
||||
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
||||
res.dat.simple
|
||||
compile_simulation <- function(scenario) {
|
||||
name <- as.numeric(gsub("[^0-9.-]", "", substr(scenario,start=0,stop=2)))
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
zz <- substr(scenario,start=0,stop=nchar(scenario)-4)
|
||||
b <- data.frame(scenario=zz,
|
||||
scenario.type=substr(zz,start=0,stop=nchar(zz)-1),
|
||||
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),
|
||||
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))
|
||||
d <- cbind(b,a,z)
|
||||
d$prop.
|
||||
return(d)
|
||||
}
|
||||
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)
|
||||
}
|
||||
View(res.dat)
|
||||
res.dat.simple <- res.dat[,c(1:7,12,15:17)]
|
||||
res.dat.simple$m.beta <- round(res.dat.simple$m.beta,3)
|
||||
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
|
||||
compile_simulation <- function(scenario) {
|
||||
name <- as.numeric(gsub("[^0-9.-]", "", substr(scenario,start=0,stop=2)))
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
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),
|
||||
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))
|
||||
d <- cbind(b,a,z)
|
||||
d$prop.
|
||||
return(d)
|
||||
}
|
||||
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)
|
||||
}
|
||||
View(res.dat)
|
||||
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
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
||||
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
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
plot(h0.rejected.p~dif.size,data=res.null)
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)+points(h0.rejected.p~dif.size,data=res.null)
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(h0.rejected.p~dif.size,data=res.null)
|
||||
points(h0.rejected.p~1.dif.size,data=res.null)
|
||||
points(h0.rejected.p~1+dif.size,data=res.null)
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(h0.rejected.p~1+dif.size,data=res.null)
|
||||
points(y=h0.rejected.p,x=0,data=res.null)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(y=h0.rejected.p,x=0,data=res.null)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(y=res.null$h0.rejected.p,x=0)
|
||||
points(y=res.null$h0.rejected.p,x=rep(0,nrow(res.null)))
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(y=res.null$h0.rejected.p,x=rep(0,nrow(res.null)))
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
points(y=res.null$h0.rejected.p,x=rep(1,nrow(res.null)))
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null)
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)))
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)))
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)))
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)))
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)))
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col=2)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(2,nrow(res.null5)),col=3)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)))
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col=2)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col=3)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),'gray')
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray')
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='darkred')
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='darkgreen')
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pty=2)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pty=2)
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='darkred',pty=2)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='darkgreen',pty=2)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='darkred',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='darkgreen',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3))
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='#053305',pch=3)
|
||||
par(mfrow=c(2,2))
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 1 item')
|
||||
res.null0 <- res.null[res.null$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.null[res.null$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='#053305',pch=3)
|
||||
# 2 items
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==2,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 2 items')
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
res.null
|
||||
par(mfrow=c(2,2))
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 1 item')
|
||||
res.null3 <- res.null[res.null$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(3,nrow(res.null5)),col='#053305',pch=3)
|
||||
par(mfrow=c(2,2))
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 1 item')
|
||||
res.null3 <- res.null[res.null$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(2,nrow(res.null5)),col='#053305',pch=3)
|
||||
par(mfrow=c(2,2))
|
||||
# 0 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='No DIF')
|
||||
points(y=res.null$h0.rejected.p,x=rep(1,nrow(res.null)),col='#590b0c',pch=3)
|
||||
par(mfrow=c(2,2))
|
||||
# 0 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='No DIF',ylim=c(0,1))
|
||||
points(y=res.null$h0.rejected.p,x=rep(1,nrow(res.null)),col='#590b0c',pch=3)
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 1 item',ylim=c(0,1))
|
||||
res.null3 <- res.null[res.null$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(2,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==2,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 2 items',ylim=c(0,1))
|
||||
par(mfrow=c(2,2))
|
||||
# 0 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='No DIF',ylim=c(0,1))
|
||||
points(y=res.null$h0.rejected.p,x=rep(1,nrow(res.null)),col='#590b0c',pch=3)
|
||||
# 1 item
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==1,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 1 item',ylim=c(0,1))
|
||||
res.null3 <- res.null[res.null$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(2,nrow(res.null5)),col='#053305',pch=3)
|
||||
# 2 items
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==2,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 2 items',ylim=c(0,1))
|
||||
# 2 items
|
||||
res.null <- res.dat[res.dat$eff.size==0 & res.dat$nb.dif==2,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(2,3),xlab='DIF size',
|
||||
ylab='H0 rejection proportion in target scenario',main='DIF on 2 items',ylim=c(0,1))
|
||||
res.null
|
||||
res.dat$nb.dif
|
||||
table(res.dat$scenario)
|
||||
cumsum(table(res.dat$scenario))
|
||||
table(res.dat[1:132]$scenario)
|
||||
table(res.dat[1:132,]$scenario)
|
||||
nrow(res.dat)
|
||||
res.dat[132:300,'nb.dif'] <- 2
|
||||
res.dat[300:396,'nb.dif'] <- 3
|
||||
View(res.dat)
|
||||
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
|
||||
#### plots
|
||||
## Proportion of rejected h0 per dif value in h0 scenarios (A) by DIF size
|
||||
res.null <- res.dat[res.dat$eff.size==0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(1,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(1,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size==0 & res.dat$dif.size==0.3,]
|
||||
@ -510,3 +154,359 @@ points(y=res.null3$h0.rejected.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.null[res.null$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(2,nrow(res.null5)),col='#053305',pch=3)
|
||||
par(mfrow=c(1,1))
|
||||
# Overall
|
||||
boxplot(beta.same.sign.truebeta.p~dif.size,data=res.dat,col=c(2,3),xlab='DIF size',
|
||||
ylab='Proportion of estimates with same sign as true value in target scenario',main='DIF on 3 items',ylim=c(0,1))
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(5,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(2,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(4,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(3,nrow(res.null3)),col='gray',pch=3)
|
||||
#### 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(100,200,300),function(x) paste0(results,'_',x)))
|
||||
results2 <- c(sapply(c(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)-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)
|
||||
)
|
||||
}
|
||||
}
|
||||
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$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)
|
||||
}
|
||||
library(TAM)
|
||||
library(doMC)
|
||||
library(parallel)
|
||||
library(pbmcapply)
|
||||
library(funprog)
|
||||
library(dplyr)
|
||||
#### 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(100,200,300),function(x) paste0(results,'_',x)))
|
||||
results2 <- c(sapply(c(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)-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)
|
||||
)
|
||||
}
|
||||
}
|
||||
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$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)
|
||||
}
|
||||
res.dat[res.dat$scenario.type=='A','dif.size'] <- -res.dat[res.dat$scenario.type=='A','dif.size']
|
||||
res.dat[is.na(res.dat$dif.size),'dif.size'] <- 0
|
||||
res.dat[132:300,'nb.dif'] <- 2
|
||||
res.dat[300:396,'nb.dif'] <- 3
|
||||
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
|
||||
boxplot(beta.same.sign.truebeta.signif.p~dif.size,data=res.dat,col=c(2,3),xlab='DIF size',
|
||||
ylab='Proportion of estimates with same sign as true value in target scenario',main='DIF on 3 items',ylim=c(0,1))
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(5,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(2,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(4,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.p,x=rep(3,nrow(res.null3)),col='gray',pch=3)
|
||||
boxplot(beta.same.sign.truebeta.signif.p~dif.size,data=res.dat,col=c(2,3),xlab='DIF size',
|
||||
ylab='Proportion of estimates with same sign as true value in target scenario',main='DIF on 3 items',ylim=c(0,1))
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.signif.p,x=rep(1,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.5,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.signif.p,x=rep(5,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.signif.p,x=rep(2,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.signif.p,x=rep(4,nrow(res.null3)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$dif.size==0,]
|
||||
points(y=res.null3$beta.same.sign.truebeta.signif.p,x=rep(3,nrow(res.null3)),col='gray',pch=3)
|
||||
## Proportion of rejected h0 per dif value in h0 scenarios (A) by DIF size
|
||||
res.null <- res.dat[res.dat$eff.size!=0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,1),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size!=0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size!=0 & res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size!=0 & res.dat$dif.size==-0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,1),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='gray',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.3,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(4,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.5,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(5,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0 & res.dat$N==100,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0 & res.dat$N==100,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(4,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(5,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size>0 & res.dat$N==300,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0 & res.dat$N==300,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.3 & res.dat$N==300,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==-0.5 & res.dat$N==300,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.3 & res.dat$N==300,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(4,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size>0 & res.dat$dif.size==0.5 & res.dat$N==300,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(5,nrow(res.null5)),col='#053305',pch=3)
|
||||
############# By N // EFF SIZE NEGATIVE
|
||||
####### N=100
|
||||
res.null <- res.dat[res.dat$eff.size<0 & res.dat$N==100,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0 & res.dat$N==100,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(4,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(5,nrow(res.null5)),col='#053305',pch=3)
|
||||
####### N=300 // DIF à 0.5 - QUELS SONT LES SCENARIOS EN HAUT
|
||||
res.null <- res.dat[res.dat$eff.size<0 & res.dat$N==300,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0 & res.dat$N==300,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.3 & res.dat$N==300,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.5 & res.dat$N==300,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0.3 & res.dat$N==300,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(4,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0.5 & res.dat$N==300,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(5,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size<0 & res.dat$N==100,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0 & res.dat$N==100,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size<0 & res.dat$N==300,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0 & res.dat$N==300,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.3 & res.dat$N==300,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.5 & res.dat$N==300,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
res.null <- res.dat[res.dat$eff.size<0 & res.dat$N==100,]
|
||||
boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2,4,2,3),xlab='DIF size',ylab='H0 rejection proportion in target scenario')
|
||||
res.null0 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==0 & res.dat$N==100,]
|
||||
points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='darkblue',pch=3)
|
||||
res.null3 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.3 & res.dat$N==100,]
|
||||
points(y=res.null3$h0.rejected.p,x=rep(2,nrow(res.null3)),col='#590b0c',pch=3)
|
||||
res.null5 <- res.dat[res.dat$eff.size<0 & res.dat$dif.size==-0.5 & res.dat$N==100,]
|
||||
points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3)
|
||||
muA=5
|
||||
muB=10
|
||||
kappa=1
|
||||
sd=10
|
||||
alpha=0.05
|
||||
beta=0.20
|
||||
(nB=(1+1/kappa)*(sd*(qnorm(1-alpha/2)+qnorm(1-beta))/(muA-muB))^2)
|
||||
ceiling(nB) # 63
|
||||
z=(muA-muB)/(sd*sqrt((1+1/kappa)/nB))
|
||||
(Power=pnorm(z-qnorm(1-alpha/2))+pnorm(-z-qnorm(1-alpha/2)))
|
||||
muA=5
|
||||
muB=10
|
||||
kappa=1
|
||||
sd=10
|
||||
alpha=0.05
|
||||
beta=0.20
|
||||
(nB=(1+1/kappa)*(sd*(qnorm(1-alpha/2)+qnorm(1-beta))/(muA-muB))^2)
|
||||
ceiling(nB) # 63
|
||||
z=(muA-muB)/(sd*sqrt((1+1/kappa)/nB))
|
||||
(Power=pnorm(z-qnorm(1-alpha/2))+pnorm(-z-qnorm(1-alpha/2)))
|
||||
|
Reference in New Issue
Block a user