Corrected code for getting logs
This commit is contained in:
@ -760,6 +760,113 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
|
||||
//Variance et se mA
|
||||
matrix var_mA = (val_mA[1,"/var(THETA)#0bn.`gp'"]\val_mA[2,"/var(THETA)#0bn.`gp'"])
|
||||
|
||||
*************************************************************
|
||||
***********************AFFICHAGE*****************************
|
||||
*************************************************************
|
||||
|
||||
|
||||
//Affichage modèle A
|
||||
di
|
||||
di as input "PROCESSING STEP A"
|
||||
di
|
||||
|
||||
if "`detail'" != "" {
|
||||
/* Affichage des estimations des difficultés modèle A */
|
||||
|
||||
di _col(5) as text "{ul:MODEL A:} Overall measurement non-invariance between groups"
|
||||
di
|
||||
di %~85s as text "Item difficulties: estimates (s.e.)"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(31) as text abbrev("`gp'",20) "=0" _col(57) abbrev("`gp'",20) "=1"
|
||||
di _col(10) "{hline 65}"
|
||||
forvalues j=1/`nbitems' {
|
||||
di as text _col(10) abbrev("``j''", 18)
|
||||
forvalues p=1/`nbdif_`j'' {
|
||||
di as text _col(10) "`p'" as result _col(30) %6.2f `delta`j'_`p'g0mA' %6.2f " (" %3.2f `delta`j'_`p'g0mA_se' ")" _col(56) %6.2f `delta`j'_`p'g1mA' " (" %3.2f `delta`j'_`p'g1mA_se' ")"
|
||||
}
|
||||
}
|
||||
di as text _col(10) "{hline 65}"
|
||||
/* Affichage des estimations sur le trait latent du modèle A */
|
||||
di
|
||||
di %~85s as text "Latent trait distribution"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(31) "Estimate" _col(57) "Standard error"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(10) "Variance" as result _col(31) %6.2f `=var_mA[1,1]' _col(55) %6.2f `=var_mA[2,1]'
|
||||
di _col(10) as text "Group effect" as result _col(31) "0 (constrained)"
|
||||
di _col(10) as text "{hline 65}"
|
||||
di
|
||||
di _col(10) as text "No group effect: equality of the latent trait means between groups"
|
||||
di _col(10) as text "All item difficulties are freely estimated in both groups"
|
||||
di
|
||||
}
|
||||
//*Affichage modèle B
|
||||
|
||||
di
|
||||
di as input "PROCESSING STEP B"
|
||||
di
|
||||
|
||||
/* Affichage des estimations des difficultés modèle B */
|
||||
if "`detail'" != "" {
|
||||
di _col(5) as text "{ul:MODEL B:} Overall measurement invariance between groups"
|
||||
di
|
||||
di %~85s as text "Item difficulties: estimates (s.e.)"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(31) abbrev("`gp'",20) "=0" _col(57) abbrev("`gp'",20) "=1"
|
||||
di _col(10) "{hline 65}"
|
||||
|
||||
forvalues j=1/`nbitems' {
|
||||
di _col(10) as text "``j''"
|
||||
forvalues p=1/`nbdif_`j'' {
|
||||
di as text _col(10) "`p'" as result _col(30) %6.2f `delta`j'_`p'g0mB' " (" %3.2f `delta`j'_`p'g0mB_se' ")" _col(56) %6.2f `delta`j'_`p'g1mB' " (" %3.2f `delta`j'_`p'g1mB_se' ")"
|
||||
}
|
||||
}
|
||||
|
||||
di _col(10) as text "{hline 65}"
|
||||
/* Affichage des estimations sur le trait latent du modèle B */
|
||||
di
|
||||
di %~85s as text "Latent trait distribution"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(28) "Estimate" _col(42) "Standard error" _col(62) "P-value"
|
||||
di _col(10) "{hline 65}"
|
||||
di _col(10) "Variance" as result _col(28) %6.2f `=var_mB[1,1]' _col(40) %6.2f `=var_mB[2,1]'
|
||||
di _col(10) as text "Group effect" as result _col(28) %6.2f `geffmB' _col(40) %6.2f `segeffmB' _col(62) %6.4f `gcmBp'
|
||||
di _col(10) as text "{hline 65}"
|
||||
di
|
||||
di _col(10) as text "Group effect estimated: mean of the latent trait of group 1 freely estimated"
|
||||
di _col(10) "Equality of the item difficulties between groups"
|
||||
di
|
||||
}
|
||||
|
||||
*****************************************************
|
||||
* Modèle A vs Modèle B *
|
||||
*****************************************************
|
||||
|
||||
qui lrtest modeldifA modeldifB
|
||||
local diftestp=r(p)
|
||||
local diftestchi=r(chi2)
|
||||
local diftestdf=r(df)
|
||||
//affichage lrtest
|
||||
di as input "LIKELIHOOD-RATIO TEST"
|
||||
di
|
||||
di %~60s "Model A vs Model B"
|
||||
di _col(10) "{hline 40}"
|
||||
di _col(10) as text "Chi-square" _col(28) "DF" _col(40) "P-value"
|
||||
di _col(10) as result %6.2f `diftestchi' _col(28) %2.0f `diftestdf' _col(40) %6.4f `diftestp'
|
||||
di _col(10) as text "{hline 40}"
|
||||
di
|
||||
|
||||
|
||||
if `diftestp'<0.05{
|
||||
di as result "DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS LIKELY"
|
||||
}
|
||||
else{
|
||||
di as result "NO DIFFERENCE BETWEEN GROUPS DETECTED"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*********************************
|
||||
*************MODEL C*************
|
||||
*********************************
|
||||
@ -787,15 +894,12 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
|
||||
local nbsig=0
|
||||
local minpval=1
|
||||
local itemdif=0
|
||||
if "`detail'" != ""{
|
||||
|
||||
di as text "Loop `boucle'"
|
||||
di as text _col(5) "Adjusted alpha: " %6.4f `pajust'
|
||||
di
|
||||
di as text _col(10) "{hline 65}"
|
||||
di as text _col(10) "Freed item" _col(31) "Chi-Square" _col(48) "DF" _col(57) "P-Value"
|
||||
di as text _col(10) "{hline 65}"
|
||||
}
|
||||
/*boucle de test*/
|
||||
forvalues j=1/`nbitems'{
|
||||
//if `nbdif_`j'' > 2 {
|
||||
@ -856,40 +960,32 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
|
||||
local itemdif=`j'
|
||||
}
|
||||
}
|
||||
if "`detail'" != "" {
|
||||
di as text _col(10) abbrev("``j''",15) as result _col(31) %6.3f test_dif_`boucle'[`j',1] _col(48) test_dif_`boucle'[`j',2] _col(57) %6.4f test_dif_`boucle'[`j',3]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*si nb de tests significatifs=0, on arrête*/
|
||||
if `nbsig'==0{
|
||||
local stop=1
|
||||
if `boucle' == 1 {
|
||||
if "`detail'" != "" {
|
||||
di as text _col(10) "{hline 65}"
|
||||
di
|
||||
di as result "No significant test: no difference between groups detected, no DIF detected"
|
||||
di
|
||||
}
|
||||
}
|
||||
else {
|
||||
if "`detail'" != ""{
|
||||
di as text _col(10) "{hline 65}"
|
||||
di
|
||||
di as result "No other significant tests"
|
||||
di
|
||||
}
|
||||
}
|
||||
}
|
||||
else{/*si nb de tests significatifs>0, mise à jour de la matrice de résultats*/
|
||||
matrix dif_rc[`itemdif',1]=`boucle'
|
||||
if "`detail'" != ""{
|
||||
di as text _col(10) "{hline 65}"
|
||||
di
|
||||
di as result "Difference between groups on ``itemdif'' at time 1"
|
||||
}
|
||||
if `nbmoda_`itemdif'' > 2 {
|
||||
if "`detail'" != "" {
|
||||
|
||||
di
|
||||
di %~60s as text "Test of uniform difference"
|
||||
@ -897,7 +993,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
|
||||
di _col(10) as text "Chi-square" _col(28) "DF" _col(40) "P-value"
|
||||
di _col(10) as result %4.2f `=test_difu_`boucle'[`itemdif',1]' _col(28) `=test_difu_`boucle'[`itemdif',2]' _col(40) %4.2f `=test_difu_`boucle'[`itemdif',3]'
|
||||
di _col(10) as text "{hline 40}"
|
||||
}
|
||||
|
||||
if test_difu_`boucle'[`itemdif',3]<0.05{ /*DIF NU détectée*/
|
||||
matrix dif_rc[`itemdif',2]=0
|
||||
di
|
||||
|
Reference in New Issue
Block a user