From b7da3574ff1014fddbb8b0581c90c857cc4954fd Mon Sep 17 00:00:00 2001 From: corentinchoisy Date: Tue, 26 Dec 2023 20:27:59 +0100 Subject: [PATCH] updated simirt.R --- Modules/simirt.R | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Modules/simirt.R b/Modules/simirt.R index b1a982a..fea4fef 100644 --- a/Modules/simirt.R +++ b/Modules/simirt.R @@ -190,29 +190,52 @@ while(s>2^31-1) { set.seed(s) if (typediff=='uniform') { - if (nbdiff %/% 2*length(DIM)==1) { + min <- c() + max <- c() + if (nbdiff %/% (2*length(DIM))==1) { min <- DIF[(1:length(DIM)-1)*2+2] max <- DIF[(1:length(DIM)-1)*2+3] } else if (nbdiff==1) { - min <- c(-2) - max <- c(2) + min <- rep(-2,length(DIM)) + max <- rep(2,length(DIM)) } else { stop('Your DIF option is incorrect. Please correct.') } for (d in seq(1,length(DIM))) { for (i in seq(1,DIM[d])) { - DIF[(d-1)+i] <- min[d]+(max[d]-min[d])*i/(DIM[d]+1) # Pas compris, demander à JB + DIF <- c(DIF, min[d]+(max[d]-min[d])*i/(DIM[d]+1) ) # Pas compris, demander à JB } } } else if (typediff=='gauss') { + meang <- c() + varg <- c() + if (nbdiff %/% (2*length(DIM))==1) { + for (d in seq(1,length(DIM))) { + meang[d] <- DIF[(d-1)*2+2] + varg[d] <- DIF[(d-1)*2+3] + } + } + else if (nbdiff == 1) { + meang <- rep(0,length(DIM)) + varg <- rep(1,length(DIM)) + } + else { + stop('Error 198: Your DIF option is incorrect. Please correct.') + } + for (d in seq(1,length(DIM))) { + for (i in seq(1,DIM[d])) { + tmp <- qnorm(p=i/(DIM[d]+1))*sqrt(varg[d])+meang[d] + DIF <- c(DIF, tmp) + } + } } - +for