|
|
|
@ -566,8 +566,8 @@ 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'+6+2+1
|
|
|
|
|
local nbdif = 2
|
|
|
|
|
local taillemat = 3*`nbitems'+`nbdif'+6+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" "dif2_1" "dif2_2" "dif2_3" "beta" "se_beta" "dif_item_1" "dif_item_2"
|
|
|
|
|
di "Scenario 10`scen' / N=`Nnn'"
|
|
|
|
@ -724,12 +724,12 @@ forvalues i=1/`nbitems' {
|
|
|
|
|
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))"
|
|
|
|
|
}
|
|
|
|
|
if (`i'==`difitems2') {
|
|
|
|
|
local constrnt = "constraint 2 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 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 mod "gsem "
|
|
|
|
|
forvalues i=1/`nbitems' {
|
|
|
|
|
if (`i'==`difitems1') {
|
|
|
|
|
if (`i'==`difitems1'| `i'==`difitems2') {
|
|
|
|
|
local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)"
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -738,6 +738,7 @@ forvalues i=1/`nbitems' {
|
|
|
|
|
}
|
|
|
|
|
local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent constraint(1 2)"
|
|
|
|
|
qui `constrnt'
|
|
|
|
|
qui `constrn2'
|
|
|
|
|
qui `mod'
|
|
|
|
|
mat V=r(table)
|
|
|
|
|
mat W=V[1..2,1...]
|
|
|
|
@ -763,7 +764,7 @@ forvalues j=1/`nbitems' {
|
|
|
|
|
* replications sans problèmes
|
|
|
|
|
else {
|
|
|
|
|
local difitems1=dif1
|
|
|
|
|
local difitems1=dif2
|
|
|
|
|
local difitems2=dif2
|
|
|
|
|
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))"
|
|
|
|
@ -776,7 +777,7 @@ forvalues i=1/`nbitems' {
|
|
|
|
|
}
|
|
|
|
|
local mod "gsem "
|
|
|
|
|
forvalues i=1/`nbitems' {
|
|
|
|
|
if (`i'==`difitems1') {
|
|
|
|
|
if (`i'==`difitems1' | `i'==`difitems2') {
|
|
|
|
|
local mod = "`mod'"+"(1.item`i'<-THETA@1 tt)(2.item`i'<-THETA@2 tt)(3.item`i'<-THETA@3 tt)"
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -786,34 +787,24 @@ forvalues i=1/`nbitems' {
|
|
|
|
|
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'<`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*`j'-2] = W[1,colnumb(W,"1.item`j':_cons")] // items avant le premier dif
|
|
|
|
|
mat outmat[`k',3*`j'-1] = W[1,colnumb(W,"2.item`j':_cons")] // items avant le premier dif
|
|
|
|
|
mat outmat[`k',3*`j'] = W[1,colnumb(W,"3.item`j':_cons")] // 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*(`difitems2'-1)+2] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+5] = W[1,7*(`difitems2'-1)+5] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+6] = W[1,7*(`difitems2'-1)+8] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+7] = W[1,7*`nbitems'+4] // beta
|
|
|
|
|
mat outmat[`k',3*`nbitems'+8] = W[2,7*`nbitems'+4] // se beta
|
|
|
|
|
mat outmat[`k',3*`nbitems'+1] = W[1,colnumb(W,"1.item`difitems1':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+2] = W[1,colnumb(W,"2.item`difitems1':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+3] = W[1,colnumb(W,"3.item`difitems1':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+4] = W[1,colnumb(W,"1.item`difitems2':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+5] = W[1,colnumb(W,"2.item`difitems2':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+6] = W[1,colnumb(W,"3.item`difitems2':tt")] // coef de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+7] = W[1,colnumb(W,"THETA:tt")] // beta
|
|
|
|
|
mat outmat[`k',3*`nbitems'+8] = W[2,colnumb(W,"THETA:tt")] // se beta
|
|
|
|
|
mat outmat[`k',3*`nbitems'+9] = `difitems1' // numéro item de dif
|
|
|
|
|
mat outmat[`k',3*`nbitems'+10] = `difitems2' // numéro item de dif
|
|
|
|
|
restore
|
|
|
|
|