diff --git a/RProject/.RData b/RProject/.RData index f94fd32..efe36e3 100644 Binary files a/RProject/.RData and b/RProject/.RData differ diff --git a/RProject/.Rhistory b/RProject/.Rhistory index b09d209..1a3e606 100644 --- a/RProject/.Rhistory +++ b/RProject/.Rhistory @@ -1,512 +1,512 @@ -N <- substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)) -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) -} -res.dat.dif -## Proportion of rejected h0 per dif value in h0 scenarios (A) by DIF size -res.null <- res.dat.dif[res.dat.dif$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.dif[res.dat.dif$eff.size==0 & res.dat.dif$dif.size==0,] -points(y=res.null0$h0.rejected.p,x=rep(3,nrow(res.null0)),col='gray',pch=3) -res.null3 <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$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.dif[res.dat.dif$eff.size==0 & res.dat.dif$dif.size==-0.5,] -points(y=res.null5$h0.rejected.p,x=rep(1,nrow(res.null5)),col='#053305',pch=3) -par(mfrow=c(2,2)) -# 0 item -res.null <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$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)) -par(mfrow=c(2,2)) -# 0 item -res.null <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$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)) -res.null -par(mfrow=c(2,2)) -# 1 item -res.null <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$nb.dif==1,] -boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2),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(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(1,nrow(res.null5)),col='#053305',pch=3) -# 2 items -res.null <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$nb.dif==2,] -boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2),xlab='DIF size', -ylab='H0 rejection proportion in target scenario',main='DIF on 2 items',ylim=c(0,1)) -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(1,nrow(res.null5)),col='#053305',pch=3) -# 3 items -res.null <- res.dat.dif[res.dat.dif$eff.size==0 & res.dat.dif$nb.dif==3,] -boxplot(h0.rejected.p~dif.size,data=res.null,col=c(3,2),xlab='DIF size', -ylab='H0 rejection proportion in target scenario',main='DIF on 3 items',ylim=c(0,1)) -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(1,nrow(res.null5)),col='#053305',pch=3) -par(mfrow=c(1,1)) -res.dat.dif +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +#### Scenarios with J=4 / M=2 +# B / Effect size 0.2 / +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1B" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios with Effect size 0.2') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='red') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='blue') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='purple') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='orange') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +# B / Effect size 0.2 / +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1B" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios with Effect size 0.2') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='red') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='red') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='blue') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='blue') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='purple') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='purple') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='orange') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='orange') +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 library(TAM) library(doMC) library(parallel) library(pbmcapply) library(funprog) library(dplyr) -lastChar <- function(str){ -substr(str, nchar(str)-2, nchar(str)) -} -#### 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)[61:396] -#### 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))=="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) -) -} -} -zz <- substr(scenario,start=0,stop=nchar(scenario)-4) -N <- substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)) -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') library(readxl) -#### 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)[61:396] -#### 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))=="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) -) -} -} -zz <- substr(scenario,start=0,stop=nchar(scenario)-4) -N <- substr(scenario,start=nchar(scenario)-2,stop=nchar(scenario)) -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) -} -res.dat.dif -paste(c(1,5,7,9,11),'A') -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,]$true.power -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,] -###### Puissance théorique -### 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -### 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==200,]$theoretical.power <- 0.2613 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==200,]$theoretical.power <- 0.2613 -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.2613 -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.2613 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==200,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==200,]$theoretical.power <- 0.7507 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==200,]$theoretical.power <- 0.3256 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==200,]$theoretical.power <- 0.3256 -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.3256 -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.3256 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,]$theoretical.power -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,] -## Scénarios J=4 / M=2 -res.dat$theoretical.power <- 0 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'A') & res.dat$N==100,]$theoretical.power <- 0.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat$theoretical.power -###### 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'C') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(3,'C') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -### 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==200,]$theoretical.power <- 0.2613 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==200,]$theoretical.power <- 0.2613 -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.2613 -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.2613 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==200,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==200,]$theoretical.power <- 0.7507 -## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==200,]$theoretical.power <- 0.3256 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==200,]$theoretical.power <- 0.3256 -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.3256 -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.3256 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==200,]$theoretical.power <- 0.8538 -### 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==300,]$theoretical.power <- 0.3658 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==300,]$theoretical.power <- 0.3658 -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.3658 -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.3658 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(2,'C') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==300,]$theoretical.power <- 0.8981 -## 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.0250 -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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(4,'C') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat$theoretical.power -61:nrow(res.dat) -res.dat[61:nrow(res.dat),] -res.dat[61:nrow(res.dat),]$scenario -res.dat[61:nrow(res.dat),]$theoretical.power -res.dat.dif$theoretical.power <- res.dat[61:nrow(res.dat),]$theoretical.power +res.dat$bias +par(mfrow=c(1,1)) +#### Scenarios with J=4 / M=2 +# A / H=0 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$bias)) +mean.A +par(mfrow=c(1,1)) +#### Scenarios with J=4 / M=2 +# A / H=0 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$bias)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Bias', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(-1,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +#### Scenarios with J=4 / M=2 +# B/ H=0 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1B" & plot.dat$N==x,]$bias)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Bias', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(-1,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='red') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='red') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='blue') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='blue') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='purple') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='purple') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='orange') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='orange') +## Plot 1 - baseline scenarios vs theoretical power +par(mfrow=c(1,2)) +# theoretical +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),rep(unique(plot.dat[plot.dat$scenario.type=="A",]$theoretical.power),3), +xlab='N',ylab='Theoretical power', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c0c23b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#a12471',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#9b6541',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#1a342b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',lty=4) +points(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$N), +rep(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$theoretical.power),3),col='#03a18a',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c0c23b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#a12471',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#9b6541',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#1a342b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',pch=17) +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), +pch=rep(17,5), +legend=c("Scenario A", +"Scenario 1-2 / B-D", +"Scenario 3-4 / B-D", +"Scenario 1-2 / C-E", +"Scenario 3-4 / C-E"),cex=0.7) +# real +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +mean.A,col='#c6d18d',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +mean.A,col='#c0c23b',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +mean.A,col='#da77c7',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +mean.A,col='#a12471',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +mean.A,col='#b5a180',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +mean.A,col='#9b6541',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +mean.A,col='#30a466',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +mean.A,col='#1a342b',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +mean.A,col='#c6d18d',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +mean.A,col='#c0c23b',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +mean.A,col='#da77c7',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +mean.A,col='#a12471',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +mean.A,col='#b5a180',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +mean.A,col='#9b6541',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +mean.A,col='#30a466',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +mean.A,col='#1a342b',pch=17) +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), +pch=rep(17,5), +legend=c("Scenario A", +"Scenario 1-2 / B-D", +"Scenario 3-4 / B-D", +"Scenario 1-2 / C-E", +"Scenario 3-4 / C-E"),cex=0.7) +par(mfrow=c(1,1)) +#### Scenarios with J=4 / M=2 +# A / H=0 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +# B / Effect size 0.2 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1B" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios with Effect size 0.2') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11B" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='red') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='red') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='blue') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='blue') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='purple') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='purple') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='orange') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='orange') +par(mfrow=c(1,1)) +#### Scenarios with J=4 / M=2 +# A / H=0 +plot.dat <- res.dat +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#a12471') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#9b6541') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#1a342b') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +pch=17,col='#c0c23b') +## Plot 1 - baseline scenarios vs theoretical power +par(mfrow=c(1,2)) +# theoretical +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),rep(unique(plot.dat[plot.dat$scenario.type=="A",]$theoretical.power),3), +xlab='N',ylab='Theoretical power', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c0c23b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#a12471',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#9b6541',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#1a342b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',lty=4) +points(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$N), +rep(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$theoretical.power),3),col='#03a18a',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c0c23b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#a12471',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#9b6541',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#1a342b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',pch=17) +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), +pch=rep(17,5), +legend=c("Scenario A", +"Scenario 1-2 / B-D", +"Scenario 3-4 / B-D", +"Scenario 1-2 / C-E", +"Scenario 3-4 / C-E"),cex=0.7) +# real +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, +xlab='N',ylab='Proportion of null hypothesis rejection', +xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +mean.A,col='#c6d18d',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +mean.A,col='#c0c23b',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +mean.A,col='#da77c7',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +mean.A,col='#a12471',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +mean.A,col='#b5a180',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +mean.A,col='#9b6541',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +mean.A,col='#30a466',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +mean.A,col='#1a342b',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), +mean.A,col='#c6d18d',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), +mean.A,col='#c0c23b',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), +mean.A,col='#da77c7',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), +mean.A,col='#a12471',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), +mean.A,col='#b5a180',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), +mean.A,col='#9b6541',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), +mean.A,col='#30a466',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), +mean.A,col='#1a342b',pch=17) +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), +pch=rep(17,5), +legend=c("Scenario A", +"Scenario 1-2 / B-D", +"Scenario 3-4 / B-D", +"Scenario 1-2 / C-E", +"Scenario 3-4 / C-E"),cex=0.7) +library(tinytex) +tlmgr_install('soul') diff --git a/RProject/Scripts/pcm.R b/RProject/Scripts/pcm.R index 3b22e41..0b50161 100644 --- a/RProject/Scripts/pcm.R +++ b/RProject/Scripts/pcm.R @@ -2266,6 +2266,8 @@ for (x in results[seq(2,length(results))]) { res.dat.dif <- bind_rows(res.dat.dif,y) } +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 ############################################################################## #----------------------------------------------------------------------------# @@ -2281,118 +2283,118 @@ res.dat$theoretical.power <- 0 ## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'F') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 +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.4626 -res.dat[res.dat$scenario %in% paste0(1,'D') & res.dat$N==100,]$theoretical.power <- 0.1524 -res.dat[res.dat$scenario %in% paste0(1,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==100,]$theoretical.power <- 0.4626 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==100,]$theoretical.power <- 0.4626 +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.4626 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==100,]$theoretical.power <- 0.1522 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==100,]$theoretical.power <- 0.4626 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'F') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 +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.5669 -res.dat[res.dat$scenario %in% paste0(3,'D') & res.dat$N==100,]$theoretical.power <- 0.1857 -res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==100,]$theoretical.power <- 0.5669 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==100,]$theoretical.power <- 0.5669 +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.5669 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==100,]$theoretical.power <- 0.1852 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==100,]$theoretical.power <- 0.5669 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==200,]$theoretical.power <- 0.2613 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==200,]$theoretical.power <- 0.2613 +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.2613 +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.2613 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==200,]$theoretical.power <- 0.7507 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==200,]$theoretical.power <- 0.4626 +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.7507 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==200,]$theoretical.power <- 0.2606 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==200,]$theoretical.power <- 0.7507 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(3,13,15,17,19),'B') & res.dat$N==200,]$theoretical.power <- 0.3256 -res.dat[res.dat$scenario %in% paste0(c(13,15,17,19),'C') & res.dat$N==200,]$theoretical.power <- 0.3256 +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.3256 +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.3256 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==200,]$theoretical.power <- 0.8538 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==200,]$theoretical.power <- 0.8538 +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.8538 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==200,]$theoretical.power <- 0.3251 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==200,]$theoretical.power <- 0.8538 +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 @@ -2401,35 +2403,35 @@ res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==200,]$theoretical.power ## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(1,5,7,9,11),'B') & res.dat$N==300,]$theoretical.power <- 0.3658 -res.dat[res.dat$scenario %in% paste0(c(5,7,9,11),'C') & res.dat$N==300,]$theoretical.power <- 0.3658 +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.3658 +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.3658 +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.0250 -res.dat[res.dat$scenario %in% paste0(c(2,6,8,10,12),'B') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'C') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'D') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'E') & res.dat$N==300,]$theoretical.power <- 0.8981 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'F') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(c(6,8,10,12),'G') & res.dat$N==300,]$theoretical.power <- 0.8981 +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.8981 -res.dat[res.dat$scenario %in% paste0(2,'D') & res.dat$N==300,]$theoretical.power <- 0.3652 -res.dat[res.dat$scenario %in% paste0(2,'E') & res.dat$N==300,]$theoretical.power <- 0.8981 +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.0250 +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 @@ -2443,19 +2445,19 @@ res.dat[res.dat$scenario %in% paste0(3,'E') & res.dat$N==300,]$theoretical.power ## 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.0250 -res.dat[res.dat$scenario %in% paste0(c(4,14,16,18,20),'B') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'C') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'D') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'E') & res.dat$N==300,]$theoretical.power <- 0.9584 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'F') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(c(14,16,18,20),'G') & res.dat$N==300,]$theoretical.power <- 0.9584 +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.9584 -res.dat[res.dat$scenario %in% paste0(4,'D') & res.dat$N==300,]$theoretical.power <- 0.4547 -res.dat[res.dat$scenario %in% paste0(4,'E') & res.dat$N==300,]$theoretical.power <- 0.9584 +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 ### DIF scenarios -res.dat.dif$theoretical.power <- res.dat[61:nrow(res.dat),]$theoretical.power +res.dat.dif$theoretical.power <- res.dat[61:nrow(res.dat),]$theoretical.power \ No newline at end of file diff --git a/RProject/Scripts/power_analysis.R b/RProject/Scripts/power_analysis.R new file mode 100644 index 0000000..ab1d3f3 --- /dev/null +++ b/RProject/Scripts/power_analysis.R @@ -0,0 +1,293 @@ +############################################################################## +#----------------------------------------------------------------------------# +################################# POWER PLOTS ################################ +#----------------------------------------------------------------------------# +############################################################################## + +## Plot 1 - baseline scenarios vs theoretical power + +par(mfrow=c(1,2)) + +# theoretical + +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] + +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),rep(unique(plot.dat[plot.dat$scenario.type=="A",]$theoretical.power),3), + xlab='N',ylab='Theoretical power', + xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c6d18d',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#da77c7',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#b5a180',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#30a466',lty=4) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',lty=4) + +points(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$N), + rep(unique(plot.dat[plot.dat$scenario %in% c("1A",'1A'),]$theoretical.power),3),col='#03a18a',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$theoretical.power),col='#c6d18d',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$theoretical.power),col='#c0c23b',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$theoretical.power),col='#da77c7',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$theoretical.power),col='#a12471',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$theoretical.power),col='#b5a180',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$theoretical.power),col='#9b6541',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$theoretical.power),col='#30a466',pch=17) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), + unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$theoretical.power),col='#1a342b',pch=17) + +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), + pch=rep(17,5), + legend=c("Scenario A", + "Scenario 1-2 / B-D", + "Scenario 3-4 / B-D", + "Scenario 1-2 / C-E", + "Scenario 3-4 / C-E"),cex=0.7) + + +# real + +plot.dat <- res.dat[res.dat$scenario %in% sapply(c('A','B','C','D','E'),function(x) paste0(1:4,x)),] + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + xlab='N',ylab='Proportion of null hypothesis rejection', + xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), + mean.A,col='#c6d18d',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), + mean.A,col='#c0c23b',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), + mean.A,col='#da77c7',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), + mean.A,col='#a12471',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), + mean.A,col='#b5a180',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), + mean.A,col='#9b6541',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), + mean.A,col='#30a466',lty=4) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), + mean.A,col='#1a342b',lty=4) + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario.type=="A" & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,pch=17,col='#03a18a') +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1B","1D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1B",'1D'),]$N), + mean.A,col='#c6d18d',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2B","2D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2B",'2D'),]$N), + mean.A,col='#c0c23b',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3B","3D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3B",'3D'),]$N), + mean.A,col='#da77c7',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4B","4D") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4B",'4D'),]$N), + mean.A,col='#a12471',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("1C","1E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("1C",'1E'),]$N), + mean.A,col='#b5a180',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("2C","2E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("2C",'2E'),]$N), + mean.A,col='#9b6541',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("3C","3E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("3C",'3E'),]$N), + mean.A,col='#30a466',pch=17) +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario%in% c("4C","4E") & plot.dat$N==x,]$h0.rejected.p)) +points(unique(plot.dat[plot.dat$scenario %in% c("4C",'4E'),]$N), + mean.A,col='#1a342b',pch=17) +legend("topleft",lty=rep(4,5),col=c("#03a18a","#c0c23b","#a12471","#9b6541","#1a342b"), + pch=rep(17,5), + legend=c("Scenario A", + "Scenario 1-2 / B-D", + "Scenario 3-4 / B-D", + "Scenario 1-2 / C-E", + "Scenario 3-4 / C-E"),cex=0.7) + + + +############################################################################## +#----------------------------------------------------------------------------# +################################# ALPHA PLOTS ################################ +#----------------------------------------------------------------------------# +############################################################################## + +par(mfrow=c(1,1)) + +#### Scenarios with J=4 / M=2 + +# A / H=0 + +plot.dat <- res.dat + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$h0.rejected.p)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + xlab='N',ylab='Proportion of null hypothesis rejection', + xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(0,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#03a18a') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#a12471') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#9b6541') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#1a342b') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11A" & plot.dat$N==x,]$h0.rejected.p)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#c0c23b') + + + + + + +############################################################################## +#----------------------------------------------------------------------------# +################################# BIAS PLOTS ################################# +#----------------------------------------------------------------------------# +############################################################################## + +par(mfrow=c(1,1)) + +#### Scenarios with J=4 / M=2 + +# A / H=0 + +plot.dat <- res.dat + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1A" & plot.dat$N==x,]$bias)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + xlab='N',ylab='Bias', + xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(-1,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#03a18a') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#a12471') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#9b6541') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#1a342b') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11A" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#c0c23b') + + +par(mfrow=c(1,1)) + +#### Scenarios with J=4 / M=2 + +# B/ H=0 + +plot.dat <- res.dat + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="1B" & plot.dat$N==x,]$bias)) +plot(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + xlab='N',ylab='Bias', + xaxt='n',yaxt='n',type='l',xlim=c(100,300),ylim=c(-1,1),lty=4,col='#03a18a',main='Scenarios where H0 is TRUE') +axis(1,c(100,200,300)) +axis(2,seq(0,1,0.1)) +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#03a18a') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#a12471') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#a12471') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#9b6541') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#9b6541') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#1a342b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#1a342b') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11B" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='#c0c23b') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='#c0c23b') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="5C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='red') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='red') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="7C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='blue') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='blue') + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="9C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='purple') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='purple') + + +mean.A <- sapply(c(100,200,300),function(x) mean(plot.dat[plot.dat$scenario=="11C" & plot.dat$N==x,]$bias)) +lines(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A,lty=4,col='orange') +points(unique(plot.dat[plot.dat$scenario.type=="A",]$N),mean.A, + pch=17,col='orange') diff --git a/Scripts/Analysis/DIF/pcm_dif_50.do b/Scripts/Analysis/DIF/pcm_dif_50.do new file mode 100644 index 0000000..61d6dad --- /dev/null +++ b/Scripts/Analysis/DIF/pcm_dif_50.do @@ -0,0 +1,1515 @@ + *================================================================================================================================================= + * Date : 2024-01-23 + * Stata version : Stata 18 SE + * + * This program analyses simulated data accounting for DIF through a partial credit model + * + * ado-files needed : - pcm (version 5.5 October 25, 2023, available on gitea) + * + * outputs : for N=100 + * + * + *================================================================================================================================================ + + * Load pcm.ado + adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + + *========================== + * Scenarios with : J=4 + *========================== + + ****** Scenarios with DIF on 1 item + + ** Scenario 5: J = 4 items / M = 2 modalities / DIF size 0.3 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_5`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 4 + local nbdif = 1 + local taillemat = `nbitems'+`nbdif'+3 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "dif1" "beta" "se_beta" "dif_item_1" + di "Scenario 5`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitems1') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitems1'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`nbitems'+2] // beta + mat outmat[`k',`nbitems'+3] = W[2,3*`nbitems'+2] // se beta + mat outmat[`k',`nbitems'+4] = `difitems1' // numéro item de dif + restore + } + putexcel set "`path_res'/out/5`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + +** Scenario 6: J = 4 items / M = 4 modalities / DIF size 0.3 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_6`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 4 +local nbdif = 1 +local taillemat = 3*`nbitems'+`nbdif'+3+2 +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "dif1_1" "dif1_2" "dif1_3" "beta" "se_beta" "dif_item_1" +di "Scenario 6`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2)" + qui `constrnt' + qui `constrnt2' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitems1') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitems1') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitems1'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitems1'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitems1'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*`nbitems'+4] // beta + mat outmat[`k',3*`nbitems'+5] = W[2,7*`nbitems'+4] // se beta + mat outmat[`k',3*`nbitems'+6] = `difitems1' // numéro item de dif + restore +} +putexcel set "`path_res'/out/6`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + + +** Scenario 7: J = 4 items / M = 2 modalities / DIF size 0.5 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_7`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 4 + local nbdif = 1 + local taillemat = `nbitems'+`nbdif'+3 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "dif1" "beta" "se_beta" "dif_item_1" + di "Scenario 7`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitems1') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitems1'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`nbitems'+2] // beta + mat outmat[`k',`nbitems'+3] = W[2,3*`nbitems'+2] // se beta + mat outmat[`k',`nbitems'+4] = `difitems1' // numéro item de dif + restore + } + putexcel set "`path_res'/out/7`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + +** Scenario 8: J = 4 items / M = 4 modalities / DIF size 0.5 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_8`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 4 +local nbdif = 1 +local taillemat = 3*`nbitems'+`nbdif'+3+2 +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "dif1_1" "dif1_2" "dif1_3" "beta" "se_beta" "dif_item_1" +di "Scenario 8`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitems1') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2)" + qui `constrnt' + qui `constrnt2' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitems1') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitems1') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitems1'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitems1'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitems1'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*`nbitems'+4] // beta + mat outmat[`k',3*`nbitems'+5] = W[2,7*`nbitems'+4] // se beta + mat outmat[`k',3*`nbitems'+6] = `difitems1' // numéro item de dif + restore +} +putexcel set "`path_res'/out/8`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + + +****** Scenarios with DIF on 2 items + +* Load pcm.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +** Scenario 9: J = 4 items / M = 2 modalities / DIF size 0.3 x2 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_9`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 4 + local nbdif = 2 + local taillemat = `nbitems'+`nbdif'+4 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "dif1" "dif2" "beta" "se_beta" "dif_item_1" "dif_item_2" + di "Scenario 9`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmax'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`nbitems'+3] // beta + mat outmat[`k',`nbitems'+4] = W[2,3*`nbitems'+3] // se beta + mat outmat[`k',`nbitems'+5] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+6] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/9`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 10: J = 4 items / M = 4 modalities / DIF size 0.3 x2 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_10`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 4 +local nbdif = 2 +local taillemat = 3*`nbitems'+6+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "beta" "se_beta" "dif_item_1" "dif_item_2" +di "Scenario 10`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmax'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*`nbitems'+7] // beta + mat outmat[`k',3*`nbitems'+8] = W[2,7*`nbitems'+7] // se beta + mat outmat[`k',3*`nbitems'+9] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+10] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/10`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 11: J = 4 items / M = 2 modalities / DIF size 0.5 x2 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_11`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 4 + local nbdif = 2 + local taillemat = `nbitems'+`nbdif'+4 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "dif1" "dif2" "beta" "se_beta" "dif_item_1" "dif_item_2" + di "Scenario 11`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmax'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`nbitems'+3] // beta + mat outmat[`k',`nbitems'+4] = W[2,3*`nbitems'+3] // se beta + mat outmat[`k',`nbitems'+5] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+6] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/11`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 12: J = 4 items / M = 4 modalities / DIF size 0.5 x2 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_12`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 4 +local nbdif = 2 +local taillemat = 3*`nbitems'+6+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "beta" "se_beta" "dif_item_1" "dif_item_2" +di "Scenario 12`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmax'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*`nbitems'+7] // beta + mat outmat[`k',3*`nbitems'+8] = W[2,7*`nbitems'+7] // se beta + mat outmat[`k',3*`nbitems'+9] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+10] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/12`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + + + +*========================== +* Scenarios with : J=7 +*========================== + + +****** Scenarios with DIF on 2 items + +* Load pcm.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +** Scenario 13: J = 7 items / M = 2 modalities / DIF size 0.3 x2 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_13`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 7 + local nbdif = 2 + local taillemat = `nbitems'+`nbdif'+4 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "item5" "item6" "item7" "dif1" "dif2" "beta" "se_beta" "dif_item_1" "dif_item_2" + di "Scenario 13`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmax'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`nbitems'+3] // beta + mat outmat[`k',`nbitems'+4] = W[2,3*`nbitems'+3] // se beta + mat outmat[`k',`nbitems'+5] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+6] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/13`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 14: J = 7 items / M = 4 modalities / DIF size 0.3 x2 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_14`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 7 +local nbdif = 2 +local taillemat = 3*`nbitems'+6+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "item5_1" "item5_2" "item5_3" "item6_1" "item6_2" "item6_3" "item7_1" "item7_2" "item7_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "beta" "se_beta" "dif_item_1" "dif_item_2" +di "Scenario 14`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmax'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*`nbitems'+7] // beta + mat outmat[`k',3*`nbitems'+8] = W[2,7*`nbitems'+7] // se beta + mat outmat[`k',3*`nbitems'+9] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+10] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/14`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 15: J = 7 items / M = 2 modalities / DIF size 0.5 x2 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_15`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 7 + local nbdif = 2 + local taillemat = `nbitems'+`nbdif'+4 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "item5" "item6" "item7" "dif1" "dif2" "beta" "se_beta" "dif_item_1" "dif_item_2" + di "Scenario 15`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmax'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`nbitems'+3] // beta + mat outmat[`k',`nbitems'+4] = W[2,3*`nbitems'+3] // se beta + mat outmat[`k',`nbitems'+5] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+6] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/15`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 16: J = 7 items / M = 4 modalities / DIF size 0.5 x2 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_16`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 7 +local nbdif = 2 +local taillemat = 3*`nbitems'+6+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "item5_1" "item5_2" "item5_3" "item6_1" "item6_2" "item6_3" "item7_1" "item7_2" "item7_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "beta" "se_beta" "dif_item_1" "dif_item_2" +di "Scenario 16`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + if (`difitems1'<`difitems2') { + local difitemsmin `difitems1' + local difitemsmax `difitems2' + } + else { + local difitemsmin `difitems2' + local difitemsmax `difitems1' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmax'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*`nbitems'+7] // beta + mat outmat[`k',3*`nbitems'+8] = W[2,7*`nbitems'+7] // se beta + mat outmat[`k',3*`nbitems'+9] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+10] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/16`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + +***** Scenarios with DIF on 3 items + +* Load pcm.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +** Scenario 17: J = 7 items / M = 2 modalities / DIF size 0.3 x3 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_17`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 7 + local nbdif = 3 + local taillemat = `nbitems'+`nbdif'+5 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "item5" "item6" "item7" "dif1" "dif2" "dif3" "beta" "se_beta" "dif_item_1" "dif_item_2" "dif_item_3" + di "Scenario 17`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + local difitems3=dif3 + if (`difitems1' < `difitems2') { + local difitemsmin= `difitems1' + local difitemsmax= `difitems2' + } + else { + local difitemsmin= `difitems2' + local difitemsmax= `difitems1' + } + if (`difitems3' < `difitemsmin') { + local difitemsmid = `difitemsmin' + local difitemsmin= `difitems3' + } + else if (`difitems3' > `difitemsmax') { + local difitemsmid = `difitemsmax' + local difitemsmax= `difitems3' + } + else { + local difitemsmid = `difitems3' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax' | `i'==`difitemsmid') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmid') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + else { + mat outmat[`k',`j'] = W[1,3+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmid'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`difitemsmax'+1] // coef de dif + mat outmat[`k',`nbitems'+4] = W[1,3*`nbitems'+4] // beta + mat outmat[`k',`nbitems'+5] = W[2,3*`nbitems'+4] // se beta + mat outmat[`k',`nbitems'+6] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+7] = `difitemsmid' // numéro item de dif + mat outmat[`k',`nbitems'+8] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/17`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 18: J = 7 items / M = 4 modalities / DIF size 0.3 x3 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_18`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 7 +local nbdif = 3 +local taillemat = 3*`nbitems'+9+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "item5_1" "item5_2" "item5_3" "item6_1" "item6_2" "item6_3" "item7_1" "item7_2" "item7_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "dif3_1" "dif3_2" "dif3_3" "beta" "se_beta" "dif_item_1" "dif_item_2" "dif_item_3" +di "Scenario 18`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + local difitems3=dif3 + if (`difitems1' < `difitems2') { + local difitemsmin= `difitems1' + local difitemsmax= `difitems2' + } + else { + local difitemsmin= `difitems2' + local difitemsmax= `difitems1' + } + if (`difitems3' < `difitemsmin') { + local difitemsmid = `difitemsmin' + local difitemsmin= `difitems3' + } + else if (`difitems3' > `difitemsmax') { + local difitemsmid = `difitemsmax' + local difitemsmax= `difitems3' + } + else { + local difitemsmid = `difitems3' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmid') { + local constrn5 = "constraint 5 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt6 = "constraint 6 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax' | `i'==`difitemsmid') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4 5 6)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `constrnt6' + qui `constrnt6' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmid') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmid') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+13] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+16] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+12] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+14] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+16] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmid'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmid'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmid'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+8] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+9] = W[1,7*(`difitemsmax'-1)+14] // coef de dif + mat outmat[`k',3*`nbitems'+10] = W[1,7*`nbitems'+10] // beta + mat outmat[`k',3*`nbitems'+11] = W[2,7*`nbitems'+10] // se beta + mat outmat[`k',3*`nbitems'+12] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+13] = `difitemsmid' // numéro item de dif + mat outmat[`k',3*`nbitems'+14] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/18`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} + +** Scenario 19: J = 7 items / M = 2 modalities / DIF size 0.5 x3 + local N = "50" + foreach Nnn in `N' { + local Nn = `Nnn' + local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" + local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" + local scenarios = "A B C D E F G" + foreach scen in `scenarios' { + clear + import delim "`path_data'/scenario_19`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear + rename TT tt + + * Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif + local nbitems = 7 + local nbdif = 3 + local taillemat = `nbitems'+`nbdif'+5 + mat outmat = J(1000,`taillemat',.) + mat colnames outmat = "item1" "item2" "item3" "item4" "item5" "item6" "item7" "dif1" "dif2" "dif3" "beta" "se_beta" "dif_item_1" "dif_item_2" "dif_item_3" + di "Scenario 19`scen' / N=`Nnn'" + forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + local difitems3=dif3 + if (`difitems1' < `difitems2') { + local difitemsmin= `difitems1' + local difitemsmax= `difitems2' + } + else { + local difitemsmin= `difitems2' + local difitemsmax= `difitems1' + } + if (`difitems3' < `difitemsmin') { + local difitemsmid = `difitemsmin' + local difitemsmin= `difitems3' + } + else if (`difitems3' > `difitemsmax') { + local difitemsmid = `difitemsmax' + local difitemsmax= `difitems3' + } + else { + local difitemsmid = `difitems3' + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax' | `i'==`difitemsmid') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent" + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',`j'] = W[1,3*`j'] // items avant le premier dif + } + else if (`j'<`difitemsmid') { + mat outmat[`k',`j'] = W[1,1+3*`j'] // items après le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',`j'] = W[1,2+3*`j'] // items après le deuxieme dif + } + else { + mat outmat[`k',`j'] = W[1,3+3*`j'] // items après le deuxieme dif + } + } + mat outmat[`k',`nbitems'+1] = W[1,3*`difitemsmin'-1] // coef de dif + mat outmat[`k',`nbitems'+2] = W[1,3*`difitemsmid'] // coef de dif + mat outmat[`k',`nbitems'+3] = W[1,3*`difitemsmax'+1] // coef de dif + mat outmat[`k',`nbitems'+4] = W[1,3*`nbitems'+4] // beta + mat outmat[`k',`nbitems'+5] = W[2,3*`nbitems'+4] // se beta + mat outmat[`k',`nbitems'+6] = `difitemsmin' // numéro item de dif + mat outmat[`k',`nbitems'+7] = `difitemsmid' // numéro item de dif + mat outmat[`k',`nbitems'+8] = `difitemsmax' // numéro item de dif + restore + } + putexcel set "`path_res'/out/19`scen'_`Nn'.xls", sheet("outmat") replace + putexcel A1=matrix(outmat), colnames +} +} + + + +** Scenario 20: J = 7 items / M = 4 modalities / DIF size 0.5 x3 +local N = "50" +foreach Nnn in `N' { +local Nn = `Nnn' +local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N`Nn'" +local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/DIF/N`Nn'" +local scenarios = "A B C D E F G" +foreach scen in `scenarios' { +clear +import delim "`path_data'/scenario_20`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear +rename TT tt + +* Matrice de taille 1000 * 4 items + 1 DIF + beta + std beta + 1 dif +local nbitems = 7 +local nbdif = 3 +local taillemat = 3*`nbitems'+9+2+`nbdif' +mat outmat = J(1000,`taillemat',.) +mat colnames outmat = "item1_1" "item1_2" "item1_3" "item2_1" "item2_2" "item2_3" "item3_1" "item3_2" "item3_3" "item4_1" "item4_2" "item4_3" "item5_1" "item5_2" "item5_3" "item6_1" "item6_2" "item6_3" "item7_1" "item7_2" "item7_3" "dif1_1" "dif1_2" "dif1_3" "dif2_1" "dif2_2" "dif2_3" "dif3_1" "dif3_2" "dif3_3" "beta" "se_beta" "dif_item_1" "dif_item_2" "dif_item_3" +di "Scenario 20`scen' / N=`Nnn'" +forvalues k=1/1000 { + if (mod(`k',100)==0) { + di "`k'/1000" + } + preserve + qui keep if replication==`k' + local difitems1=dif1 + local difitems2=dif2 + local difitems3=dif3 + if (`difitems1' < `difitems2') { + local difitemsmin= `difitems1' + local difitemsmax= `difitems2' + } + else { + local difitemsmin= `difitems2' + local difitemsmax= `difitems1' + } + if (`difitems3' < `difitemsmin') { + local difitemsmid = `difitemsmin' + local difitemsmin= `difitems3' + } + else if (`difitems3' > `difitemsmax') { + local difitemsmid = `difitemsmax' + local difitemsmax= `difitems3' + } + else { + local difitemsmid = `difitems3' + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin') { + local constrnt = "constraint 1 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt2 = "constraint 2 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmax') { + local constrn3 = "constraint 3 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt4 = "constraint 4 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + forvalues i=1/`nbitems' { + if (`i'==`difitemsmid') { + local constrn5 = "constraint 5 2*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([2.item`i']_cons-([2.item`i']_cons+[2.item`i'] tt))" + local constrnt6 = "constraint 6 3*([1.item`i']_cons-([1.item`i']_cons+[1.item`i'] tt))=([3.item`i']_cons-([3.item`i']_cons+[3.item`i'] tt))" + } + } + local mod "gsem " + forvalues i=1/`nbitems' { + if (`i'==`difitemsmin' | `i'==`difitemsmax' | `i'==`difitemsmid') { + local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)" + } + else { + local mod = "`mod'"+"(1.item`i'<-THETA@1)(2.item`i'<-THETA@2)(3.item`i'<-THETA@3)" + } + } + local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2 3 4 5 6)" + qui `constrnt' + qui `constrnt2' + qui `constrnt3' + qui `constrnt4' + qui `constrnt6' + qui `constrnt6' + qui `mod' + mat V=r(table) + mat W=V[1..2,1...] + forvalues j=1/`nbitems' { + if (`j'<`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+3] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+5] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+7] // items avant le premier dif + } + else if (`j'==`difitemsmin') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+4] // items du le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+7] // items du le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items du le premier dif } + } + else if (`j'<`difitemsmid') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+6] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+8] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+10] // items avant le premier dif + } + else if (`j'==`difitemsmid') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+7] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else if (`j'<`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+9] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+11] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+13] // items avant le premier dif + } + else if (`j'==`difitemsmax') { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+10] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+13] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+16] // items avant le premier dif + } + else { + mat outmat[`k',3*`j'-2] = W[1,7*(`j'-1)+12] // items avant le premier dif + mat outmat[`k',3*`j'-1] = W[1,7*(`j'-1)+14] // items avant le premier dif + mat outmat[`k',3*`j'] = W[1,7*(`j'-1)+16] // items avant le premier dif + } + } + mat outmat[`k',3*`nbitems'+1] = W[1,7*(`difitemsmin'-1)+2] // coef de dif + mat outmat[`k',3*`nbitems'+2] = W[1,7*(`difitemsmin'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+3] = W[1,7*(`difitemsmin'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+4] = W[1,7*(`difitemsmid'-1)+5] // coef de dif + mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitemsmid'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitemsmid'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+7] = W[1,7*(`difitemsmax'-1)+8] // coef de dif + mat outmat[`k',3*`nbitems'+8] = W[1,7*(`difitemsmax'-1)+11] // coef de dif + mat outmat[`k',3*`nbitems'+9] = W[1,7*(`difitemsmax'-1)+14] // coef de dif + mat outmat[`k',3*`nbitems'+10] = W[1,7*`nbitems'+10] // beta + mat outmat[`k',3*`nbitems'+11] = W[2,7*`nbitems'+10] // se beta + mat outmat[`k',3*`nbitems'+12] = `difitemsmin' // numéro item de dif + mat outmat[`k',3*`nbitems'+13] = `difitemsmid' // numéro item de dif + mat outmat[`k',3*`nbitems'+14] = `difitemsmax' // numéro item de dif + restore +} +putexcel set "`path_res'/out/20`scen'_`Nn'.xls", sheet("outmat") replace +putexcel A1=matrix(outmat), colnames +} +} diff --git a/Scripts/Scenarios/DIF/scenarios_DIF_J4_baseline_50.do b/Scripts/Scenarios/DIF/scenarios_DIF_J4_baseline_50.do new file mode 100644 index 0000000..09d2152 --- /dev/null +++ b/Scripts/Scenarios/DIF/scenarios_DIF_J4_baseline_50.do @@ -0,0 +1,3815 @@ +*================================================================================================================================================= +* Date : 2024-01-04 +* Stata version : Stata 18 SE +* +* This program creates dataset with DIF for a randomized controlled trial scenario. +* 4 items +* +* ado-files needed : - simirt (version 4.3 August 29, 2019, available on OSF) +* + * outputs : scenario_5,scenario_6,scenario_7,scenario_8,scenario_9,scenario_10,scenario_11,scenario_12 for N=50 +* +* +* Warning : To obtain reproduce the data obtained in the .csv files in this repository, use 'simirt_setseed.ado' instead of 'simirt.ado' +* +*================================================================================================================================================ + +* Load simirt.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +* Set data output folder path + +local path = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50" +local Nn = 50 + +*========================== +* Scenarios with : J=4 +*========================== + +************** Scenarios with : DIF on 1 item ************** + +**** Scenarios with : DIF size 0.3 **** + +** Scenario 5: J = 4 items / M = 2 modalities / DIF SIZE = 0.3 + +* Scenario 5A : H_0 is TRUE / DIF on treatment + +di "Scenario 5A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5A_50.csv", replace + + + * Scenario 5B : H_1 is TRUE / Effect size 0.2 / DIF on treatment + + di "Scenario 5B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5B_50.csv", replace + +* Scenario 5C : H_1 is TRUE / Effect size 0.2 / DIF negative + + di "Scenario 5C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5C_50.csv", replace + + +* Scenario 5D : H_1 is TRUE / Effect size 0.4 / DIF on treatment + + di "Scenario 5D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5D_50.csv", replace + +* Scenario 5E : H_1 is TRUE / Effect size 0.4 / DIF negative + + di "Scenario 5E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5E_50.csv", replace + +* Scenario 5F : H_1 is TRUE / Effect size -0.2 / DIF negative + + di "Scenario 5F - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5F_50.csv", replace + + + + +* Scenario 5G : H_1 is TRUE / Effect size -0.4 / DIF negative + + di "Scenario 5G - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_5G_50.csv", replace + + + + + + + + +** Scenario 6: J = 4 items / M = 4 modalities / DIF SIZE = 0.3 + +* Scenario 6A : H_0 is TRUE / DIF on treatment + +di "Scenario 6A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6A_50.csv", replace + +* Scenario 6B : H_1 is TRUE / Effect size 0.2 / DIF on treatment + + di "Scenario 6B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6B_50.csv", replace + +* Scenario 6C : H_1 is TRUE / Effect size 0.2 / DIF negative + + di "Scenario 6C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6C_50.csv", replace + +* Scenario 6D : H_1 is TRUE / Effect size 0.4 / DIF on treatment + + di "Scenario 6D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6D_50.csv", replace + +* Scenario 6E : H_1 is TRUE / Effect size 0.4 / DIF negative + + di "Scenario 6E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6E_50.csv", replace + + +* Scenario 6F : H_1 is TRUE / Effect size -0.2 / DIF negative + +di "Scenario 6E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6F_50.csv", replace + + +* Scenario 6G : H_1 is TRUE / Effect size -0.4 / DIF negative + +di "Scenario 6G - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_6G_50.csv", replace + + + +**** ---------------------------------------------------------------------------------------------------------------------------------- **** + + + + +**** Scenarios with : DIF size 0.5 **** + +** Scenario 7: J = 4 items / M = 2 modalities / DIF SIZE = 0.5 + +* Scenario 7A : H_0 is TRUE / DIF on treatment + +di "Scenario 7A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7A_50.csv", replace + + + * Scenario 7B : H_1 is TRUE / Effect size 0.2 / DIF on treatment + + di "Scenario 7B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7B_50.csv", replace + +* Scenario 7C : H_1 is TRUE / Effect size 0.2 / DIF negative + + di "Scenario 7C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7C_50.csv", replace + + +* Scenario 7D : H_1 is TRUE / Effect size 0.4 / DIF on treatment + + di "Scenario 7D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7D_50.csv", replace + +* Scenario 7E : H_1 is TRUE / Effect size 0.4 / DIF negative + + di "Scenario 7E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7E_50.csv", replace + +* Scenario 7F : H_1 is TRUE / Effect size -0.2 / DIF negative + +di "Scenario 7F - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7F_50.csv", replace + +* Scenario 7G : H_1 is TRUE / Effect size -0.4 / DIF negative + +di "Scenario 7G - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E= (0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E= (0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E= (0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E= (0 \ 0 \ 0 \ 0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_7G_50.csv", replace + + + + + + + + + + + +** Scenario 8: J = 4 items / M = 4 modalities / DIF SIZE = 0.5 + +* Scenario 8A : H_0 is TRUE / DIF on treatment + +di "Scenario 8A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8A_50.csv", replace + +* Scenario 8B : H_1 is TRUE / Effect size 0.2 / DIF on treatment + + di "Scenario 8B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8B_50.csv", replace + +* Scenario 8C : H_1 is TRUE / Effect size 0.2 / DIF negative + + di "Scenario 8C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8C_50.csv", replace + +* Scenario 8D : H_1 is TRUE / Effect size 0.4 / DIF on treatment + + di "Scenario 8D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8D_50.csv", replace + +* Scenario 8E : H_1 is TRUE / Effect size 0.4 / DIF negative + + di "Scenario 8E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8E_50.csv", replace + + +* Scenario 8F : H_1 is TRUE / Effect size -0.2 / DIF negative + +di "Scenario 8F - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8F_50.csv", replace + + +* Scenario 8G : H_1 is TRUE / Effect size -0.4 / DIF negative + +di "Scenario 8G - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui local difi = runiformint(1,4) + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E= (0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E= (0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E= (0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E= (0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_8G_50.csv", replace + + + + + + + + + + +************** Scenarios with : DIF on 2 items ************** + +**** Scenarios with : DIF size 0.3 **** + +** Scenario 9: J = 4 items / M = 2 modalities / DIF SIZE = 0.3 + +* Scenario 9A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 9A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9A_50.csv", replace + + + * Scenario 9B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 9B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9B_50.csv", replace + +* Scenario 9C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 9C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9C_50.csv", replace + + +* Scenario 9D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 9D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9D_50.csv", replace + +* Scenario 9E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 9E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9E_50.csv", replace + + + +* Scenario 9F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + + di "Scenario 9F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9F_50.csv", replace + + +* Scenario 9G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + +di "Scenario 9G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_9G_50.csv", replace + + + +** Scenario 10: J = 4 items / M = 4 modalities / DIF SIZE = 0.3 + +* Scenario 10A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 10A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10A_50.csv", replace + + + * Scenario 10B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 10B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10B_50.csv", replace + +* Scenario 10C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 10C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10C_50.csv", replace + + +* Scenario 10D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 10D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10D_50.csv", replace + +* Scenario 10E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 10E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10E_50.csv", replace + +* Scenario 10F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + + di "Scenario 10F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10F_50.csv", replace + + +* Scenario 10G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + + di "Scenario 10G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_10G_50.csv", replace + + + +**** Scenarios with : DIF size 0.5 **** + +** Scenario 11: J = 4 items / M = 2 modalities / DIF SIZE = 0.5 + +* Scenario 11A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 11A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11A_50.csv", replace + + + * Scenario 11B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 11B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11B_50.csv", replace + +* Scenario 11C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 11C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11C_50.csv", replace + + +* Scenario 11D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 11D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11D_50.csv", replace + +* Scenario 11E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 11E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11E_50.csv", replace + +* Scenario 11F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + + di "Scenario 11F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11F_50.csv", replace + + +* Scenario 11G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + + di "Scenario 11G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-0.84 \ -0.25 \ 0.25 \ 0.84) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_11G_50.csv", replace + + + +** Scenario 12: J = 4 items / M = 4 modalities / DIF SIZE = 0.5 + +* Scenario 12A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 12A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12A_50.csv", replace + + + * Scenario 12B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 12B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12B_50.csv", replace + +* Scenario 12C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 12C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12C_50.csv", replace + + +* Scenario 12D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 12D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12D_50.csv", replace + +* Scenario 12E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 12E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12E_50.csv", replace + + + +* Scenario 12F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + +di "Scenario 12F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12F_50.csv", replace + + +* Scenario 12G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + +di "Scenario 12G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 4 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_12G_50.csv", replace diff --git a/Scripts/Scenarios/DIF/scenarios_DIF_J7_baseline_50.do b/Scripts/Scenarios/DIF/scenarios_DIF_J7_baseline_50.do new file mode 100644 index 0000000..d83e4af --- /dev/null +++ b/Scripts/Scenarios/DIF/scenarios_DIF_J7_baseline_50.do @@ -0,0 +1,6109 @@ +*================================================================================================================================================= +* Date : 2024-01-04 +* Stata version : Stata 18 SE +* +* This program creates dataset with DIF for a randomized controlled trial scenario. +* 7 items +* +* ado-files needed : - simirt (version 4.3 August 29, 2019, available on OSF) +* + * outputs : scenario_13,scenario_14,scenario_15,scenario_16,scenario_17,scenario_18,scenario_19,scenario_20 for N=50 +* +* +* Warning : To obtain reproduce the data obtained in the .csv files in this repository, use 'simirt_setseed.ado' instead of 'simirt.ado' +* +*================================================================================================================================================ + +* Load simirt.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +* Set data output folder path + +local path = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N50" +local Nn = 50 + + +*========================== +* Scenarios with : J=7 +*========================== + +************** Scenarios with : DIF on 2 items ************** + +**** Scenarios with : DIF size 0.3 **** + +** Scenario 13: J = 7 items / M = 2 modalities / DIF SIZE = 0.3 + +* Scenario 13A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 13A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13A_50.csv", replace + + + * Scenario 13B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 13B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13B_50.csv", replace + +* Scenario 13C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 13C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13C_50.csv", replace + + +* Scenario 13D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 13D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13D_50.csv", replace + +* Scenario 13E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 13E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13E_50.csv", replace + + + +* Scenario 13F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + +di "Scenario 13F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13F_50.csv", replace + + + +* Scenario 13G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + +di "Scenario 13G- N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_13G_50.csv", replace + + + + +** Scenario 14: J = 7 items / M = 4 modalities / DIF SIZE = 0.3 + +* Scenario 14A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 14A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14A_50.csv", replace + + + * Scenario 14B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 14B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14B_50.csv", replace + +* Scenario 14C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 14C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14C_50.csv", replace + + +* Scenario 14D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 14D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14D_50.csv", replace + +* Scenario 14E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 14E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14E_50.csv", replace + +* Scenario 14F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + + di "Scenario 14F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14F_50.csv", replace + + + +* Scenario 14G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + +di "Scenario 14G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_14G_50.csv", replace + + +**** Scenarios with : DIF size 0.5 **** + +** Scenario 15: J = 7 items / M = 2 modalities / DIF SIZE = 0.5 + +* Scenario 15A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 15A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15A_50.csv", replace + + + * Scenario 15B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 15B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15B_50.csv", replace + +* Scenario 15C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 15C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15C_50.csv", replace + + +* Scenario 15D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 15D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15D_50.csv", replace + +* Scenario 15E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 15E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15E_50.csv", replace + + + +* Scenario 15F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + + di "Scenario 15F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15F_50.csv", replace + + + +* Scenario 15G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + +di "Scenario 15G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_15G_50.csv", replace + + + + +** Scenario 16: J = 7 items / M = 4 modalities / DIF SIZE = 0.5 + +* Scenario 16A : H_0 is TRUE / DIF on treatment x 2 + +di "Scenario 16A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16A_50.csv", replace + + + * Scenario 16B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x2 + + di "Scenario 16B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16B_50.csv", replace + +* Scenario 16C : H_1 is TRUE / Effect size 0.2 / DIF negative x2 + + di "Scenario 16C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16C_50.csv", replace + + +* Scenario 16D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x2 + + di "Scenario 16D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16D_50.csv", replace + +* Scenario 16E : H_1 is TRUE / Effect size 0.4 / DIF negative x2 + + di "Scenario 16E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16E_50.csv", replace + +* Scenario 16F : H_1 is TRUE / Effect size -0.2 / DIF negative x2 + +di "Scenario 16F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16F_50.csv", replace + + + +* Scenario 16G : H_1 is TRUE / Effect size -0.4 / DIF negative x2 + + di "Scenario 16G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 2 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_16G_50.csv", replace + + + +************** Scenarios with : DIF on 3 items ************** + +**** Scenarios with : DIF size 0.3 **** + +** Scenario 17: J = 7 items / M = 2 modalities / DIF SIZE = 0.3 + +* Scenario 17A : H_0 is TRUE / DIF on treatment x3 +di "Scenario 17A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F-G + di + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17A_50.csv", replace + + +* Scenario 17B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x3 + +di "Scenario 17B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17B_50.csv", replace + + + + + + + + + + + +* Scenario 17C : H_1 is TRUE / Effect size 0.2 / DIF negative x3 + + di "Scenario 17C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17C_50.csv", replace + + + + + + + +* Scenario 17D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x3 + + di "Scenario 17D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17D_50.csv", replace + + + + + + + + + + + + * Scenario 17E : H_1 is TRUE / Effect size 0.4 / DIF negative x3 + + di "Scenario 17E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17E_50.csv", replace + + + +* Scenario 17F : H_1 is TRUE / Effect size -0.2 / DIF negative x3 + +di "Scenario 17F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17F_50.csv", replace + + + +* Scenario 17G : H_1 is TRUE / Effect size -0.4 / DIF negative x3 + +di "Scenario 17G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difj'==1 { + mat F=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + if `difk'==1 { + mat G=(0.3 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.3 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.3 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.3 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.3 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.3 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_17G_50.csv", replace + + + + + + + +** Scenario 18: J = 7 items / M = 4 modalities / DIF SIZE = 0.3 + +* Scenario 18A : H_0 is TRUE / DIF on treatment x3 +di "Scenario 18A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F-G + di + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18A_50.csv", replace + + +* Scenario 18B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x3 + +di "Scenario 18B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18B_50.csv", replace + + + + + + + + + + + +* Scenario 18C : H_1 is TRUE / Effect size 0.2 / DIF negative x3 + + di "Scenario 18C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18C_50.csv", replace + + + + + + + +* Scenario 18D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x3 + + di "Scenario 18D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18D_50.csv", replace + + + + + + + + + + + +* Scenario 18E : H_1 is TRUE / Effect size 0.4 / DIF negative x3 + + di "Scenario 18E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18E_50.csv", replace + + + + + +* Scenario 18F : H_1 is TRUE / Effect size -0.2 / DIF negative x3 + +di "Scenario 18F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18F_50.csv", replace + + + + +* Scenario 18G : H_1 is TRUE / Effect size -0.4 / DIF negative x3 + +di "Scenario 18G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difj'==1 { + mat F=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + if `difk'==1 { + mat G=(0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.3,0.3,0.3) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_18G_50.csv", replace + + + + + + + + + + + +**** Scenarios with : DIF size 0.5 **** + + +** Scenario 19: J = 7 items / M = 2 modalities / DIF SIZE = 0.3 + +* Scenario 19A : H_0 is TRUE / DIF on treatment x3 +di "Scenario 19A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F-G + di + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19A_50.csv", replace + + +* Scenario 19B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x3 + +di "Scenario 19B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19B_50.csv", replace + + + +* Scenario 19C : H_1 is TRUE / Effect size 0.2 / DIF negative x3 + + di "Scenario 19C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19C_50.csv", replace + + + +* Scenario 19D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x3 + + di "Scenario 19D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19D_50.csv", replace + + + +* Scenario 19E : H_1 is TRUE / Effect size 0.4 / DIF negative x3 + + di "Scenario 19E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19E_50.csv", replace + + +* Scenario 19F : H_1 is TRUE / Effect size -0.2 / DIF negative x3 + +di "Scenario 19F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19F_50.csv", replace + +* Scenario 19G : H_1 is TRUE / Effect size -0.4 / DIF negative x3 + +di "Scenario 19G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + if `difi'==1 { + mat E=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==2 { + mat E=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==3 { + mat E=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difi'==4 { + mat E=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difi'==5 { + mat E=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difi'==6 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difi'==7 { + mat E=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difj'==1 { + mat F=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==2 { + mat F=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==3 { + mat F=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difj'==4 { + mat F=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difj'==5 { + mat F=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difj'==6 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difj'==7 { + mat F=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + if `difk'==1 { + mat G=(0.5 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==2 { + mat G=(0 \ 0.5 \ 0 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==3 { + mat G=(0 \ 0 \ 0.5 \ 0 \ 0 \ 0 \ 0) + } + if `difk'==4 { + mat G=(0 \ 0 \ 0 \ 0.5 \ 0 \ 0 \ 0) + } + if `difk'==5 { + mat G=(0 \ 0 \ 0 \ 0 \ 0.5 \ 0 \ 0) + } + if `difk'==6 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0.5 \ 0) + } + if `difk'==7 { + mat G=(0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_19G_50.csv", replace + + + + + +** Scenario 20: J = 7 items / M = 4 modalities / DIF SIZE = 0.3 + +* Scenario 20A : H_0 is TRUE / DIF on treatment x3 +di "Scenario 20A - N=50" + +forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F-G + di + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20A_50.csv", replace + + +* Scenario 20B : H_1 is TRUE / Effect size 0.2 / DIF on treatment x3 + +di "Scenario 20B - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20B_50.csv", replace + + +* Scenario 20C : H_1 is TRUE / Effect size 0.2 / DIF negative x3 + + di "Scenario 20C - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20C_50.csv", replace + + + +* Scenario 20D : H_1 is TRUE / Effect size 0.4 / DIF on treatment x3 + + di "Scenario 20D - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B+E+F+G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20D_50.csv", replace + + + +* Scenario 20E : H_1 is TRUE / Effect size 0.4 / DIF negative x3 + + di "Scenario 20E - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20E_50.csv", replace + + +* Scenario 20F : H_1 is TRUE / Effect size -0.2 / DIF negative x3 + +di "Scenario 20F - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20F_50.csv", replace + +* Scenario 20G : H_1 is TRUE / Effect size -0.4 / DIF negative x3 + +di "Scenario 20G - N=50" + + forvalues replication = 1/1000 { + clear + if mod(`replication',100)==0 { + di "replication = `replication'" + } + qui set obs 7 + qui gen xxx = _n + qui sample 3 ,count + qui valuesof xxx + qui local ItemsDIF = r(values) + qui local difi : word 1 of `ItemsDIF' + qui local difj : word 2 of `ItemsDIF' + qui local difk : word 3 of `ItemsDIF' + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat B= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + if `difi'==1 { + mat E=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==2 { + mat E=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==3 { + mat E=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==4 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difi'==5 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difi'==6 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difi'==7 { + mat E=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difj'==1 { + mat F=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==2 { + mat F=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==3 { + mat F=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==4 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difj'==5 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difj'==6 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difj'==7 { + mat F=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + if `difk'==1 { + mat G=(0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==2 { + mat G=(0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==3 { + mat G=(0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==4 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0 \ 0,0,0) + } + if `difk'==5 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0 \ 0,0,0) + } + if `difk'==6 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5 \ 0,0,0) + } + if `difk'==7 { + mat G=(0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0,0,0 \ 0.5,0.5,0.5) + } + mat D=B-E-F-G + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen dif1 = `difi' + qui gen dif2 = `difj' + qui gen dif3 = `difk' + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_20G_50.csv", replace diff --git a/Scripts/Scenarios/NoDIF/scenarios_noDIF_baseline_50.do b/Scripts/Scenarios/NoDIF/scenarios_noDIF_baseline_50.do new file mode 100644 index 0000000..ca56c4a --- /dev/null +++ b/Scripts/Scenarios/NoDIF/scenarios_noDIF_baseline_50.do @@ -0,0 +1,813 @@ +*================================================================================================================================================= +* Date : 2024-01-04 +* Stata version : Stata 18 SE +* +* This program creates dataset without DIF for a randomized controlled trial scenario +* +* ado-files needed : - simirt (version 4.3 August 29, 2019, available on OSF) +* + * outputs : scenario_1,scenario_2,scenario_3,scenario_4, for N=50/200/300 +* +* +* Warning : To obtain reproduce the data obtained in the .csv files in this repository, use 'simirt_setseed.ado' instead of 'simirt.ado' +* +* +*================================================================================================================================================ + +* Load simirt.ado +adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/" + +* Set data output folder path +local path = "/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF" + + + +* Scenarios with : n = 100 +*========================== + +local path = "/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N50" +local Nn = 50 + +** Scenario 1: J = 4 items / M = 2 modalities / N=50 per group / TT=treatment variable + +* Scenario 1A : H_0 is TRUE + +di "SCENARIO 1A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_1A_50.csv", replace + + + * Scenario 1B : H_0 is FALSE / Effect size = 0.2 + + di "SCENARIO 1B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_1B_50.csv", replace + +* Scenario 1C : H_0 is FALSE / Effect size = 0.4 + +di "SCENARIO 1C - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_1C_50.csv", replace + +* Scenario 1D : H_0 is FALSE / Effect size = -0.2 + + di "SCENARIO 1D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_1D_50.csv", replace + + * Scenario 1E : H_0 is FALSE / Effect size = -0.4 + + di "SCENARIO 1E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-0.84 \ -0.25 \ 0.25 \ 0.84) + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_1E_50.csv", replace + + + + +**------------------------------------------------------------------------------------** + + +** Scenario 2: J = 4 items / M = 4 modalities / N=50 per group / TT=treatment variable + + * Scenario 2A : H_0 is TRUE + di "SCENARIO 2A - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_2A_50.csv", replace + + + * Scenario 2B : H_0 is FALSE / Effect size = 0.2 + di "SCENARIO 2B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_2B_50.csv", replace + + * Scenario 2C : H_0 is FALSE / Effect size = 0.4 + di "SCENARIO 2C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_2C_50.csv", replace + + + +* Scenario 2D : H_0 is FALSE / Effect size = -0.2 + di "SCENARIO 2D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_2D_50.csv", replace + +* Scenario 2E : H_0 is FALSE / Effect size = -0.4 + di "SCENARIO 2E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(4) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.84,-0.84,0.16 \ -1.25,-0.25,0.75 \ -0.75,0.25,1.25 \ 0.16,0.84,1.84) + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(4) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_2E_50.csv", replace + + + + + + + + +**------------------------------------------------------------------------------------** + + +** Scenario 3: J = 7 items / M = 2 modalities / N=50 per group / TT=treatment variable + +* Scenario 3A : H_0 is TRUE +di "SCENARIO 3A - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_3A_50.csv", replace + + + * Scenario 3B : H_0 is FALSE / Effect size = 0.2 + di "SCENARIO 3B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_3B_50.csv", replace + +* Scenario 3C : H_0 is FALSE / Effect size = 0.4 +di "SCENARIO 3C - N=50" + +forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_3C_50.csv", replace + + +* Scenario 3D : H_0 is FALSE / Effect size = -0.2 + di "SCENARIO 3D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_3D_50.csv", replace + +* Scenario 3E : H_0 is FALSE / Effect size = -0.4 + di "SCENARIO 3E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-1.15 \ -0.67 \ -0.32 \ 0 \ 0.32 \ 0.67 \ 1.15) + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_3E_50.csv", replace + + + + + +**------------------------------------------------------------------------------------** + + +** Scenario 4: J = 7 items / M = 4 modalities / N=50 per group / TT=treatment variable + + * Scenario 4A : H_0 is TRUE + di "SCENARIO 4A - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_4A_50.csv", replace + + + * Scenario 4B : H_0 is FALSE / Effect size = 0.2 + di "SCENARIO 4B - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_4B_50.csv", replace + + * Scenario 4C : H_0 is FALSE / Effect size = 0.4 + di "SCENARIO 4C - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_4C_50.csv", replace + + +* Scenario 4D : H_0 is FALSE / Effect size = -0.2 + di "SCENARIO 4D - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(-0.2) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_4D_50.csv", replace + +* Scenario 4E : H_0 is FALSE / Effect size = -0.4 + di "SCENARIO 4E - N=50" + + forvalues replication = 1/1000 { + if mod(`replication',100)==0 { + di "replication = `replication'" + } + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(0) cov(1) dim(7) pcm(D) clear + qui gen TT = 0 + tempfile grp0 + qui save `grp0',replace + + mat D= (-2.15,-1.15,-0.15 \ -1.67,-0.67,0.33 \ -1.32,-0.32,0.68 \ -1,0,1 \ -0.68,0.32,1.32 \ -0.33,0.67,1.67 \ 0.15,1.15,2.15) + qui simirt, nbobs(`Nn') mu(-0.4) cov(1) dim(7) pcm(D) clear + qui gen TT = 1 + tempfile grp1 + qui save `grp1',replace + + clear + use `grp0' + qui append using `grp1' + drop id + qui gen id = _n + order(id) + qui gen replication = `replication' + if `replication'==1{ + tempfile data + qui save `data' + } + else{ + qui append using `data' + qui save `data',replace + } + } + export delimited using "`path'/scenario_4E_50.csv", replace