|
|
|
@ -24,7 +24,7 @@ local N = "50 100 200 300"
|
|
|
|
|
}
|
|
|
|
|
foreach scen in `scenarios' {
|
|
|
|
|
clear
|
|
|
|
|
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
|
|
|
|
|
import delim "`path_data'/`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
|
|
|
|
|
rename TT tt
|
|
|
|
|
|
|
|
|
|
if (`s'<=2) {
|
|
|
|
@ -61,6 +61,9 @@ local N = "50 100 200 300"
|
|
|
|
|
}
|
|
|
|
|
* taillemat = Maximum J*M cases pour les items par et J*M cases pour les dif par + J cases pour les DIF detect + nbdif cases pour dif réel
|
|
|
|
|
local taillemat=2*`nbitems'*`nbmoda'+`nbitems'+`nbdif'+2
|
|
|
|
|
if (mod(`s',2)==0) {
|
|
|
|
|
local taillemat=2*`nbitems'*`nbmoda'+`nbitems'+`nbitems'+`nbdif'+2
|
|
|
|
|
}
|
|
|
|
|
local colna=""
|
|
|
|
|
forvalues i=1/`nbitems' {
|
|
|
|
|
forvalues z=1/`nbmoda' {
|
|
|
|
@ -69,15 +72,18 @@ local N = "50 100 200 300"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
forvalues i=1/`nbitems' {
|
|
|
|
|
local colna = "`colna'"+"dif_detect_`i' "
|
|
|
|
|
if (mod(`s',2)==1) {
|
|
|
|
|
local colna = "`colna'"+"dif_detect_`i' "
|
|
|
|
|
}
|
|
|
|
|
if (mod(`s',2)==0) {
|
|
|
|
|
local colna = "`colna'"+"dif_detect_`i' "+"dif_detect_unif_`i' "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
forvalues i=1/`nbdif' {
|
|
|
|
|
local colna = "`colna'"+"real_dif_`i' "
|
|
|
|
|
}
|
|
|
|
|
local colna = "`colna'" + "beta " + "se_beta"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mat outmat = J(1000,`taillemat',.)
|
|
|
|
|
mat colnames outmat= `colna'
|
|
|
|
|
di "Scenario `s'`scen' / N=`Nnn'"
|
|
|
|
@ -213,7 +219,7 @@ local N = "50 100 200 300"
|
|
|
|
|
local checker2: word 2 of `val'
|
|
|
|
|
local checker3: word 3 of `val'
|
|
|
|
|
local nummoda=r(r)
|
|
|
|
|
local nbmoda_`j'=`nummoda'
|
|
|
|
|
local nbmoda_`j'=`nummoda'-1
|
|
|
|
|
if (`nummoda'==2) {
|
|
|
|
|
qui recode item`j' (`checker'=0) (`checker2'=1)
|
|
|
|
|
}
|
|
|
|
@ -239,46 +245,45 @@ local N = "50 100 200 300"
|
|
|
|
|
local nbmoda_`jj'=`nbmoda'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* ROSALI
|
|
|
|
|
qui rosali_original item1-item`nbitems' item1-item`nbitems', group(tt)
|
|
|
|
|
qui mat resmat=r(difitems)
|
|
|
|
|
local nbitems2 = 2*`nbitems'
|
|
|
|
|
|
|
|
|
|
* Calculer le nbre d'items détectés
|
|
|
|
|
local nbdetect = 0
|
|
|
|
|
local stop = 0
|
|
|
|
|
forvalues jj=1/`nbitems' {
|
|
|
|
|
qui levelsof dif_detect_`jj'
|
|
|
|
|
local detected=r(levels)
|
|
|
|
|
if (`stop'==0) {
|
|
|
|
|
mat testm=J(1,1,.)
|
|
|
|
|
if (resmat[1,`jj']==testm[1,1]) {
|
|
|
|
|
if (`detected'==testm[1,1]) {
|
|
|
|
|
local stop = 1
|
|
|
|
|
local nbdetect = `jj'-1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* Stocker les items détectés +
|
|
|
|
|
* Définition des contraintes
|
|
|
|
|
local csrt=0
|
|
|
|
|
mat testm=J(1,1,0)
|
|
|
|
|
forvalues u=1/`nbdetect' {
|
|
|
|
|
local difitems`u'=resmat[1,`u']
|
|
|
|
|
qui levelsof dif_detect_`u'
|
|
|
|
|
local detected=r(levels)
|
|
|
|
|
local difitems`u'=`detected'
|
|
|
|
|
local i=`difitems`u''
|
|
|
|
|
if (`nbmoda_`i''==3 & resmat[1,`nbitems'+`i']!=testm[1,1]){
|
|
|
|
|
qui levelsof dif_detect_unif_`u'
|
|
|
|
|
local detected_unif=r(levels)
|
|
|
|
|
if (`nbmoda_`i''==3 & `detected_unif'!=testm[1,1]){
|
|
|
|
|
local constrnt`u' = "constraint `u' 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))"
|
|
|
|
|
qui `constrnt`u''
|
|
|
|
|
local v=`u'+100
|
|
|
|
|
local constrnt`u'_2 = "constraint `v' 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))"
|
|
|
|
|
qui `constrnt`u'_2'
|
|
|
|
|
}
|
|
|
|
|
if (`nbmoda_`i''==2 & resmat[1,`nbitems'+`i']!=testm[1,1]){
|
|
|
|
|
if (`nbmoda_`i''==2 & `detected_unif'!=testm[1,1]){
|
|
|
|
|
local constrnt`u' = "constraint `u' 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))"
|
|
|
|
|
qui `constrnt`u''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* Définition du modèle
|
|
|
|
|
local mod "gsem "
|
|
|
|
|
local conformula = ""
|
|
|
|
@ -301,10 +306,13 @@ local N = "50 100 200 300"
|
|
|
|
|
local mod = "`mod'"+"(2.item`v'<-THETA@2 tt)"
|
|
|
|
|
}
|
|
|
|
|
local w= 100+`u'
|
|
|
|
|
if (resmat[1,`nbitems'+`v']!=testm[1,1] & `nbmoda_`v''==3) {
|
|
|
|
|
qui levelsof dif_detect_unif_`u'
|
|
|
|
|
local detected=r(levels)
|
|
|
|
|
local unif_`u'=r(levels)
|
|
|
|
|
if (`detected'!=testm[1,1] & `nbmoda_`v''==3) {
|
|
|
|
|
local conformula = "`conformula'" + "`u' " + "`w' "
|
|
|
|
|
}
|
|
|
|
|
else if (resmat[1,`nbitems'+`v']!=testm[1,1] & `nbmoda_`v''==2) {
|
|
|
|
|
else if (`detected'!=testm[1,1] & `nbmoda_`v''==2) {
|
|
|
|
|
local conformula = "`conformula'" + "`u' "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -325,15 +333,18 @@ local N = "50 100 200 300"
|
|
|
|
|
mat outmat[`k',colnumb(outmat,"item`j'_`z'")] = W[1,colnumb(W,"`z'.item`j':_cons")]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* compilation DIF
|
|
|
|
|
forvalues u=1/`nbdetect' {
|
|
|
|
|
local j=`difitems`u''
|
|
|
|
|
forvalues z=1/`nbmoda_`j'' {
|
|
|
|
|
mat outmat[`k',colnumb(outmat,"dif_`u'_`z'")] = W[1,colnumb(W,"`z'.item`j':tt")]
|
|
|
|
|
mat outmat[`k',colnumb(outmat,"dif_detect_`u'")] = `j'
|
|
|
|
|
}
|
|
|
|
|
mat outmat[`k',colnumb(outmat,"dif_detect_`u'")] = `j'
|
|
|
|
|
if (mod(`s',2)==0) {
|
|
|
|
|
mat outmat[`k',colnumb(outmat,"dif_detect_unif_`u'")] = `unif_`j''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* Stocker les items de DIF originaux
|
|
|
|
|
if (`nbdif' > 0) {
|
|
|
|
|
qui levelsof dif1
|
|
|
|
|