updated simirt.R

main
Corentin Choisy 1 year ago
parent 03fa430cbc
commit b7da3574ff

@ -190,29 +190,52 @@ while(s>2^31-1) {
set.seed(s) set.seed(s)
if (typediff=='uniform') { 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] min <- DIF[(1:length(DIM)-1)*2+2]
max <- DIF[(1:length(DIM)-1)*2+3] max <- DIF[(1:length(DIM)-1)*2+3]
} }
else if (nbdiff==1) { else if (nbdiff==1) {
min <- c(-2) min <- rep(-2,length(DIM))
max <- c(2) max <- rep(2,length(DIM))
} }
else { else {
stop('Your DIF option is incorrect. Please correct.') stop('Your DIF option is incorrect. Please correct.')
} }
for (d in seq(1,length(DIM))) { for (d in seq(1,length(DIM))) {
for (i in seq(1,DIM[d])) { 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') { 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

Loading…
Cancel
Save