Added uniform DIF assessment

main
Corentin Choisy 8 months ago
parent a87a080993
commit 6c3e75fc42

@ -460,59 +460,6 @@ qui count
local nbpat = r(N) local nbpat = r(N)
/*********************************
* AFFICHAGE INITIAL
*********************************/
di
di _col(5) "{hline 78}"
di _col(15) "Time 1" _col(42) "Time 2" _col(65) "Nb of Answer Cat."
di _col(5) "{hline 78}"
forvalues j=1/`nbitems' {
di as text _col(15) abbrev("``j''",20) _col(42) abbrev("``=`j'+`nbitems'''",20) _col(65) `nbmoda_`j''
}
di _col(5) "{hline 78}"
if "`group'" != "" {
di _col(10) "Nb of patients: " abbrev("`gp'",20) " 0 = `nbp_gp0' ;", abbrev("`gp'",20) " 1 = `nbp_gp1'"
di _col(5) "{hline 78}"
}
else {
di _col(10) "Nb. of patients: `nbpat'"
di _col(5) "{hline 78}"
}
di
if `nbitems' == 1 {
di as error "The analysis can only be performed with at least 2 items."
error 198
exit
}
forvalues j = 1/`nbitems' {
if `nbmoda_`j'' == 2 {
di "WARNING: ``j'' has only 2 response categories, no distinction can be made between uniform or non-uniform recalibration."
}
if `nbmoda_`j'' == 1 {
di as error "Only `nbmoda_`j'' response categories of item ``j'' were used by the sample, the analysis cannot be performed."
error 198
exit
}
if `nbmoda_`j'' == 0 {
di as error "No response categories of item ``j'' were used by the sample, the analysis cannot be performed."
error 198
exit
}
}
di
if "`group'" != "" {
di _col(2) as text "For all models : - mean of the latent trait in `gp' 0 at time 1 is constrained at 0"
di _col(19) "- equality of variances between groups"
di
}
else {
di _col(2) as text "For all models : mean of the latent trait at time 1 is constrained at 0"
di
}
/********************************* /*********************************
* DEFINITION DES CONTRAINTES * DEFINITION DES CONTRAINTES
*********************************/ *********************************/
@ -918,228 +865,20 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local ++boucle local ++boucle
} }
} }
/* MODELE FINAL DE LA PARTIE 1. Si DIFT1 détecté (=Au moins 2 boucles dans l'étape C)*/
if `nb_stepC' > 1 {
forvalues j=1/`nbitems'{
local model ""
local listconst ""
if dif_rc[`j',1]==. | dif_rc[`j',1]==0 { /*si pas de DIF: contraintes 1-200*/
forvalues p=1/`nbdif_`j''{
qui local listconst "`listconst' `=0+`maxdif'*(`j'-1)+`p''"
qui constraint list `=0+`maxdif'*(`j'-1)+`p''
}
}
else {
if dif_rc[`j',2]!=. & dif_rc[`j',2]!=0 { /*DIF U: contraintes 201-400*/
forvalues p=2/`nbdif_`j''{
qui local listconst "`listconst' `=200+`maxdif'*(`j'-1)+`p''"
qui constraint list `=200+`maxdif'*(`j'-1)+`p''
}
}
}
}
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
local model "`model' (`p'.``j''<-THETA@`p')"
}
} }
qui gsem `model', mlogit tol(0.01) iterate(100) group(`gp') ginvariant(coef loading) var(0: THETA@v) var(1:THETA@v) constraint(`listconst') from(esti_B) latent(THETA) nocapslatent
/* Stockage des estimations du modèle */
estimates store modeldifCFin
matrix val_mC = r(table)
/* Calcul des difficultés d'item (delta_j) */ matrix dif_detect = J(1,2*`nbitems',.)
matrix delta_mCFin=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC "`name_partOneC' delta_`p'_gp`g'"
}
}
local name_partOneL ""
forvalues j=1/`nbitems' {
local name_partOneL "`name_partOneL' ``j''"
}
matrix colnames delta_mCFin = `name_partOneC'
matrix rownames delta_mCFin = `name_partOneL'
matrix delta_mCFin_se=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC_se ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC_se "`name_partOneC_se' delta_`p'_gp`g'_se"
}
}
matrix colnames delta_mCFin_se = `name_partOneC_se'
matrix rownames delta_mCFin_se = `name_partOneL'
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
forvalues g=0/1{
qui lincom -[`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin=r(estimate)
local delta`j'_`p'g`g'mCFin_se=r(se)
if `p'>1{
qui lincom [`=`p'-1'.``j'']:`g'.`gp' - [`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin = r(estimate)
local delta`j'_`p'g`g'mCFin_se = r(se)
}
matrix delta_mCFin[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin'
matrix delta_mCFin_se[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin_se'
}
}
}
if "`group'" != "" { //Variance et se mA
matrix var_mC = (val_mC[1,"/var(THETA)#0bn.`gp'"]\val_mC[2,"/var(THETA)#0bn.`gp'"])
}
/*group effect*/
qui lincom [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'
local geffmCFin=r(estimate)
local segeffmCFin=r(se)
qui test [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'=0
local gcmCFinp=r(p)
local gcmCFinchi=r(chi2)
local gcmCFindf=r(df)
}
}
*********************************
*** BILAN ***
*********************************
if "`group'" != "" & "`nodif'" == "" {
di
di %~84s as result "SUMMARY"
di as result _col(2) "{hline 80}"
di as result _col(18) "Difference in"
di as result _col(2) "Item" _col(18) "groups at T1" _col(36) "Recalibration" _col(54) "RC " abbrev("`gp'",10) " 0" _col(72) "RC " abbrev("`gp'",10) " 1"
di as result _col(2) "{hline 80}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
local difft1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
if (dif_rc[`j',1] != . ) {
if (dif_rc[`j',2]!=0) {
local difft1 "Uniform"
}
else {
local difft1 "Non-uniform"
}
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
if dif_rc[`j',1] != . {
local difft1 " X "
}
}
di as result _col(2) abbrev("``j''",15) as text _col(18) "`difft1'" _col(36) "`RC'" _col(54) "`RCg0'" _col(72) "`RCg1'"
}
di as result _col(2) "{hline 80}"
di
}
else if "`group'" != "" & "`nodif'" != "" {
di
di %~90s as result "SUMMARY"
di as result _col(10) "{hline 70}"
di as result _col(10) "Item" _col(26) "Recalibration" _col(46) "RC `gp' 0" _col(62) "RC `gp' 1"
di _col(10) "{hline 70}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
}
di as result _col(10) "``j''" as text _col(26) "`RC'" _col(44) "`RCg0'" _col(62) "`RCg1'"
}
di as result _col(10) "{hline 70}"
}
else if "`group'" == "" {
di
di %~60s as result "SUMMARY"
di as result _col(10) "{hline 40}"
di _col(10) "Item" _col(36) "Recalibration"
di _col(10) "{hline 40}"
forvalues j=1/`nbitems' {
local RC
if dif_rc[`j',3] != . {
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RC "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RC "Non-uniform"
}
}
else {
local RC " X "
}
}
di as result _col(10) "``j''" as text _col(38) "`RC'"
}
di as result _col(10) "{hline 40}"
di
}
matrix dif_detect = J(1,`nbitems',.)
local numdif=1 local numdif=1
forvalues j=1/`nbitems' { forvalues j=1/`nbitems' {
if dif_rc[`j',1] != . { if dif_rc[`j',1] != . {
matrix dif_detect[1,`numdif']=`j' matrix dif_detect[1,`numdif']=`j'
if dif_rc[`j',2] == 0 {
matrix dif_detect[1,`nbitems'+`numdif']=0
}
if dif_rc[`j',2] != 0 {
matrix dif_detect[1,`nbitems'+`numdif']=1
}
local numdif = `numdif'+1 local numdif = `numdif'+1
} }
} }

@ -917,228 +917,19 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local ++boucle local ++boucle
} }
} }
/* MODELE FINAL DE LA PARTIE 1. Si DIFT1 détecté (=Au moins 2 boucles dans l'étape C)*/
if `nb_stepC' > 1 {
forvalues j=1/`nbitems'{
local model ""
local listconst ""
if dif_rc[`j',1]==. | dif_rc[`j',1]==0 { /*si pas de DIF: contraintes 1-200*/
forvalues p=1/`nbdif_`j''{
qui local listconst "`listconst' `=0+`maxdif'*(`j'-1)+`p''"
qui constraint list `=0+`maxdif'*(`j'-1)+`p''
}
}
else {
if dif_rc[`j',2]!=. & dif_rc[`j',2]!=0 { /*DIF U: contraintes 201-400*/
forvalues p=2/`nbdif_`j''{
qui local listconst "`listconst' `=200+`maxdif'*(`j'-1)+`p''"
qui constraint list `=200+`maxdif'*(`j'-1)+`p''
}
}
}
}
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
local model "`model' (`p'.``j''<-THETA@`p')"
}
}
qui gsem `model', mlogit tol(0.01) iterate(100) group(`gp') ginvariant(coef loading) var(0: THETA@v) var(1:THETA@v) constraint(`listconst') from(esti_B) latent(THETA) nocapslatent
/* Stockage des estimations du modèle */
estimates store modeldifCFin
matrix val_mC = r(table)
/* Calcul des difficultés d'item (delta_j) */
matrix delta_mCFin=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC "`name_partOneC' delta_`p'_gp`g'"
}
}
local name_partOneL ""
forvalues j=1/`nbitems' {
local name_partOneL "`name_partOneL' ``j''"
} }
matrix colnames delta_mCFin = `name_partOneC'
matrix rownames delta_mCFin = `name_partOneL'
matrix delta_mCFin_se=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC_se ""
forvalues p=1/`nbdif_max' { matrix dif_detect = J(1,2*`nbitems',.)
forvalues g=0/1 {
local name_partOneC_se "`name_partOneC_se' delta_`p'_gp`g'_se"
}
}
matrix colnames delta_mCFin_se = `name_partOneC_se'
matrix rownames delta_mCFin_se = `name_partOneL'
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
forvalues g=0/1{
qui lincom -[`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin=r(estimate)
local delta`j'_`p'g`g'mCFin_se=r(se)
if `p'>1{
qui lincom [`=`p'-1'.``j'']:`g'.`gp' - [`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin = r(estimate)
local delta`j'_`p'g`g'mCFin_se = r(se)
}
matrix delta_mCFin[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin'
matrix delta_mCFin_se[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin_se'
}
}
}
if "`group'" != "" { //Variance et se mA
matrix var_mC = (val_mC[1,"/var(THETA)#0bn.`gp'"]\val_mC[2,"/var(THETA)#0bn.`gp'"])
}
/*group effect*/
qui lincom [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'
local geffmCFin=r(estimate)
local segeffmCFin=r(se)
qui test [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'=0
local gcmCFinp=r(p)
local gcmCFinchi=r(chi2)
local gcmCFindf=r(df)
}
}
*********************************
*** BILAN ***
*********************************
if "`group'" != "" & "`nodif'" == "" {
di
di %~84s as result "SUMMARY"
di as result _col(2) "{hline 80}"
di as result _col(18) "Difference in"
di as result _col(2) "Item" _col(18) "groups at T1" _col(36) "Recalibration" _col(54) "RC " abbrev("`gp'",10) " 0" _col(72) "RC " abbrev("`gp'",10) " 1"
di as result _col(2) "{hline 80}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
local difft1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
if (dif_rc[`j',1] != . ) {
if (dif_rc[`j',2]!=0) {
local difft1 "Uniform"
}
else {
local difft1 "Non-uniform"
}
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
if dif_rc[`j',1] != . {
local difft1 " X "
}
}
di as result _col(2) abbrev("``j''",15) as text _col(18) "`difft1'" _col(36) "`RC'" _col(54) "`RCg0'" _col(72) "`RCg1'"
}
di as result _col(2) "{hline 80}"
di
}
else if "`group'" != "" & "`nodif'" != "" {
di
di %~90s as result "SUMMARY"
di as result _col(10) "{hline 70}"
di as result _col(10) "Item" _col(26) "Recalibration" _col(46) "RC `gp' 0" _col(62) "RC `gp' 1"
di _col(10) "{hline 70}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
}
di as result _col(10) "``j''" as text _col(26) "`RC'" _col(44) "`RCg0'" _col(62) "`RCg1'"
}
di as result _col(10) "{hline 70}"
}
else if "`group'" == "" {
di
di %~60s as result "SUMMARY"
di as result _col(10) "{hline 40}"
di _col(10) "Item" _col(36) "Recalibration"
di _col(10) "{hline 40}"
forvalues j=1/`nbitems' {
local RC
if dif_rc[`j',3] != . {
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RC "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RC "Non-uniform"
}
}
else {
local RC " X "
}
}
di as result _col(10) "``j''" as text _col(38) "`RC'"
}
di as result _col(10) "{hline 40}"
di
}
matrix dif_detect = J(1,`nbitems',.)
local numdif=1 local numdif=1
forvalues j=1/`nbitems' { forvalues j=1/`nbitems' {
if dif_rc[`j',1] != . { if dif_rc[`j',1] != . {
matrix dif_detect[1,`numdif']=`j' matrix dif_detect[1,`numdif']=`j'
if dif_rc[`j',2] == 0 {
matrix dif_detect[1,`nbitems'+`numdif']=0
}
if dif_rc[`j',2] != 0 {
matrix dif_detect[1,`nbitems'+`numdif']=1
}
local numdif = `numdif'+1 local numdif = `numdif'+1
} }
} }

@ -917,228 +917,19 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local ++boucle local ++boucle
} }
} }
/* MODELE FINAL DE LA PARTIE 1. Si DIFT1 détecté (=Au moins 2 boucles dans l'étape C)*/
if `nb_stepC' > 1 {
forvalues j=1/`nbitems'{
local model ""
local listconst ""
if dif_rc[`j',1]==. | dif_rc[`j',1]==0 { /*si pas de DIF: contraintes 1-200*/
forvalues p=1/`nbdif_`j''{
qui local listconst "`listconst' `=0+`maxdif'*(`j'-1)+`p''"
qui constraint list `=0+`maxdif'*(`j'-1)+`p''
}
}
else {
if dif_rc[`j',2]!=. & dif_rc[`j',2]!=0 { /*DIF U: contraintes 201-400*/
forvalues p=2/`nbdif_`j''{
qui local listconst "`listconst' `=200+`maxdif'*(`j'-1)+`p''"
qui constraint list `=200+`maxdif'*(`j'-1)+`p''
}
}
}
}
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
local model "`model' (`p'.``j''<-THETA@`p')"
}
}
qui gsem `model', mlogit tol(0.01) iterate(100) group(`gp') ginvariant(coef loading) var(0: THETA@v) var(1:THETA@v) constraint(`listconst') from(esti_B) latent(THETA) nocapslatent
/* Stockage des estimations du modèle */
estimates store modeldifCFin
matrix val_mC = r(table)
/* Calcul des difficultés d'item (delta_j) */
matrix delta_mCFin=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC "`name_partOneC' delta_`p'_gp`g'"
}
}
local name_partOneL ""
forvalues j=1/`nbitems' {
local name_partOneL "`name_partOneL' ``j''"
} }
matrix colnames delta_mCFin = `name_partOneC'
matrix rownames delta_mCFin = `name_partOneL'
matrix delta_mCFin_se=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC_se ""
forvalues p=1/`nbdif_max' { matrix dif_detect = J(1,2*`nbitems',.)
forvalues g=0/1 {
local name_partOneC_se "`name_partOneC_se' delta_`p'_gp`g'_se"
}
}
matrix colnames delta_mCFin_se = `name_partOneC_se'
matrix rownames delta_mCFin_se = `name_partOneL'
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
forvalues g=0/1{
qui lincom -[`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin=r(estimate)
local delta`j'_`p'g`g'mCFin_se=r(se)
if `p'>1{
qui lincom [`=`p'-1'.``j'']:`g'.`gp' - [`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin = r(estimate)
local delta`j'_`p'g`g'mCFin_se = r(se)
}
matrix delta_mCFin[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin'
matrix delta_mCFin_se[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin_se'
}
}
}
if "`group'" != "" { //Variance et se mA
matrix var_mC = (val_mC[1,"/var(THETA)#0bn.`gp'"]\val_mC[2,"/var(THETA)#0bn.`gp'"])
}
/*group effect*/
qui lincom [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'
local geffmCFin=r(estimate)
local segeffmCFin=r(se)
qui test [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'=0
local gcmCFinp=r(p)
local gcmCFinchi=r(chi2)
local gcmCFindf=r(df)
}
}
*********************************
*** BILAN ***
*********************************
if "`group'" != "" & "`nodif'" == "" {
di
di %~84s as result "SUMMARY"
di as result _col(2) "{hline 80}"
di as result _col(18) "Difference in"
di as result _col(2) "Item" _col(18) "groups at T1" _col(36) "Recalibration" _col(54) "RC " abbrev("`gp'",10) " 0" _col(72) "RC " abbrev("`gp'",10) " 1"
di as result _col(2) "{hline 80}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
local difft1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
if (dif_rc[`j',1] != . ) {
if (dif_rc[`j',2]!=0) {
local difft1 "Uniform"
}
else {
local difft1 "Non-uniform"
}
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
if dif_rc[`j',1] != . {
local difft1 " X "
}
}
di as result _col(2) abbrev("``j''",15) as text _col(18) "`difft1'" _col(36) "`RC'" _col(54) "`RCg0'" _col(72) "`RCg1'"
}
di as result _col(2) "{hline 80}"
di
}
else if "`group'" != "" & "`nodif'" != "" {
di
di %~90s as result "SUMMARY"
di as result _col(10) "{hline 70}"
di as result _col(10) "Item" _col(26) "Recalibration" _col(46) "RC `gp' 0" _col(62) "RC `gp' 1"
di _col(10) "{hline 70}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
}
di as result _col(10) "``j''" as text _col(26) "`RC'" _col(44) "`RCg0'" _col(62) "`RCg1'"
}
di as result _col(10) "{hline 70}"
}
else if "`group'" == "" {
di
di %~60s as result "SUMMARY"
di as result _col(10) "{hline 40}"
di _col(10) "Item" _col(36) "Recalibration"
di _col(10) "{hline 40}"
forvalues j=1/`nbitems' {
local RC
if dif_rc[`j',3] != . {
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RC "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RC "Non-uniform"
}
}
else {
local RC " X "
}
}
di as result _col(10) "``j''" as text _col(38) "`RC'"
}
di as result _col(10) "{hline 40}"
di
}
matrix dif_detect = J(1,`nbitems',.)
local numdif=1 local numdif=1
forvalues j=1/`nbitems' { forvalues j=1/`nbitems' {
if dif_rc[`j',1] != . { if dif_rc[`j',1] != . {
matrix dif_detect[1,`numdif']=`j' matrix dif_detect[1,`numdif']=`j'
if dif_rc[`j',2] == 0 {
matrix dif_detect[1,`nbitems'+`numdif']=0
}
if dif_rc[`j',2] != 0 {
matrix dif_detect[1,`nbitems'+`numdif']=1
}
local numdif = `numdif'+1 local numdif = `numdif'+1
} }
} }

@ -460,59 +460,6 @@ qui count
local nbpat = r(N) local nbpat = r(N)
/*********************************
* AFFICHAGE INITIAL
*********************************/
di
di _col(5) "{hline 78}"
di _col(15) "Time 1" _col(42) "Time 2" _col(65) "Nb of Answer Cat."
di _col(5) "{hline 78}"
forvalues j=1/`nbitems' {
di as text _col(15) abbrev("``j''",20) _col(42) abbrev("``=`j'+`nbitems'''",20) _col(65) `nbmoda_`j''
}
di _col(5) "{hline 78}"
if "`group'" != "" {
di _col(10) "Nb of patients: " abbrev("`gp'",20) " 0 = `nbp_gp0' ;", abbrev("`gp'",20) " 1 = `nbp_gp1'"
di _col(5) "{hline 78}"
}
else {
di _col(10) "Nb. of patients: `nbpat'"
di _col(5) "{hline 78}"
}
di
if `nbitems' == 1 {
di as error "The analysis can only be performed with at least 2 items."
error 198
exit
}
forvalues j = 1/`nbitems' {
if `nbmoda_`j'' == 2 {
di "WARNING: ``j'' has only 2 response categories, no distinction can be made between uniform or non-uniform recalibration."
}
if `nbmoda_`j'' == 1 {
di as error "Only `nbmoda_`j'' response categories of item ``j'' were used by the sample, the analysis cannot be performed."
error 198
exit
}
if `nbmoda_`j'' == 0 {
di as error "No response categories of item ``j'' were used by the sample, the analysis cannot be performed."
error 198
exit
}
}
di
if "`group'" != "" {
di _col(2) as text "For all models : - mean of the latent trait in `gp' 0 at time 1 is constrained at 0"
di _col(19) "- equality of variances between groups"
di
}
else {
di _col(2) as text "For all models : mean of the latent trait at time 1 is constrained at 0"
di
}
/********************************* /*********************************
* DEFINITION DES CONTRAINTES * DEFINITION DES CONTRAINTES
*********************************/ *********************************/
@ -786,15 +733,6 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local nbsig=0 local nbsig=0
local minpval=1 local minpval=1
local itemdif=0 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*/ /*boucle de test*/
forvalues j=1/`nbitems'{ forvalues j=1/`nbitems'{
//if `nbdif_`j'' > 2 { //if `nbdif_`j'' > 2 {
@ -918,228 +856,19 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local ++boucle local ++boucle
} }
} }
/* MODELE FINAL DE LA PARTIE 1. Si DIFT1 détecté (=Au moins 2 boucles dans l'étape C)*/
if `nb_stepC' > 1 {
forvalues j=1/`nbitems'{
local model ""
local listconst ""
if dif_rc[`j',1]==. | dif_rc[`j',1]==0 { /*si pas de DIF: contraintes 1-200*/
forvalues p=1/`nbdif_`j''{
qui local listconst "`listconst' `=0+`maxdif'*(`j'-1)+`p''"
qui constraint list `=0+`maxdif'*(`j'-1)+`p''
}
}
else {
if dif_rc[`j',2]!=. & dif_rc[`j',2]!=0 { /*DIF U: contraintes 201-400*/
forvalues p=2/`nbdif_`j''{
qui local listconst "`listconst' `=200+`maxdif'*(`j'-1)+`p''"
qui constraint list `=200+`maxdif'*(`j'-1)+`p''
}
}
}
}
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
local model "`model' (`p'.``j''<-THETA@`p')"
}
}
qui gsem `model', mlogit tol(0.01) iterate(100) group(`gp') ginvariant(coef loading) var(0: THETA@v) var(1:THETA@v) constraint(`listconst') from(esti_B) latent(THETA) nocapslatent
/* Stockage des estimations du modèle */
estimates store modeldifCFin
matrix val_mC = r(table)
/* Calcul des difficultés d'item (delta_j) */
matrix delta_mCFin=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC "`name_partOneC' delta_`p'_gp`g'"
}
}
local name_partOneL ""
forvalues j=1/`nbitems' {
local name_partOneL "`name_partOneL' ``j''"
}
matrix colnames delta_mCFin = `name_partOneC'
matrix rownames delta_mCFin = `name_partOneL'
matrix delta_mCFin_se=J(`nbitems',`=`nbdif_max'*2',.)
local name_partOneC_se ""
forvalues p=1/`nbdif_max' {
forvalues g=0/1 {
local name_partOneC_se "`name_partOneC_se' delta_`p'_gp`g'_se"
}
}
matrix colnames delta_mCFin_se = `name_partOneC_se'
matrix rownames delta_mCFin_se = `name_partOneL'
forvalues j=1/`nbitems'{
forvalues p=1/`nbdif_`j''{
forvalues g=0/1{
qui lincom -[`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin=r(estimate)
local delta`j'_`p'g`g'mCFin_se=r(se)
if `p'>1{
qui lincom [`=`p'-1'.``j'']:`g'.`gp' - [`p'.``j'']:`g'.`gp'
local delta`j'_`p'g`g'mCFin = r(estimate)
local delta`j'_`p'g`g'mCFin_se = r(se)
}
matrix delta_mCFin[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin'
matrix delta_mCFin_se[`j',`=2*`p'-1+`g'']=`delta`j'_`p'g`g'mCFin_se'
}
}
}
if "`group'" != "" { //Variance et se mA
matrix var_mC = (val_mC[1,"/var(THETA)#0bn.`gp'"]\val_mC[2,"/var(THETA)#0bn.`gp'"])
}
/*group effect*/
qui lincom [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'
local geffmCFin=r(estimate)
local segeffmCFin=r(se)
qui test [/]:mean(THETA)#1.`gp'-[/]:mean(THETA)#0bn.`gp'=0
local gcmCFinp=r(p)
local gcmCFinchi=r(chi2)
local gcmCFindf=r(df)
}
} }
********************************* matrix dif_detect = J(1,2*`nbitems',.)
*** BILAN ***
*********************************
if "`group'" != "" & "`nodif'" == "" {
di
di %~84s as result "SUMMARY"
di as result _col(2) "{hline 80}"
di as result _col(18) "Difference in"
di as result _col(2) "Item" _col(18) "groups at T1" _col(36) "Recalibration" _col(54) "RC " abbrev("`gp'",10) " 0" _col(72) "RC " abbrev("`gp'",10) " 1"
di as result _col(2) "{hline 80}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
local difft1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
if (dif_rc[`j',1] != . ) {
if (dif_rc[`j',2]!=0) {
local difft1 "Uniform"
}
else {
local difft1 "Non-uniform"
}
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
if dif_rc[`j',1] != . {
local difft1 " X "
}
}
di as result _col(2) abbrev("``j''",15) as text _col(18) "`difft1'" _col(36) "`RC'" _col(54) "`RCg0'" _col(72) "`RCg1'"
}
di as result _col(2) "{hline 80}"
di
}
else if "`group'" != "" & "`nodif'" != "" {
di
di %~90s as result "SUMMARY"
di as result _col(10) "{hline 70}"
di as result _col(10) "Item" _col(26) "Recalibration" _col(46) "RC `gp' 0" _col(62) "RC `gp' 1"
di _col(10) "{hline 70}"
forvalues j=1/`nbitems' {
local RC
local RCg0
local RCg1
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] == 0) {
local RC "Common"
}
if (dif_rc[`j',3] != . & dif_rc[`j',3] != 0 & dif_rc[`j',4] != 0) {
local RC "Differential"
}
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RCg0 "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RCg0 "Non-uniform"
}
if (dif_rc[`j',8]!=. & dif_rc[`j',8] != 0) {
local RCg1 "Uniform"
}
if ( dif_rc[`j',8] == 0) {
local RCg1 "Non-uniform"
}
}
else {
if dif_rc[`j',6] != . {
local RCg0 " X "
}
if dif_rc[`j',8] != . {
local RCg1 " X "
}
}
di as result _col(10) "``j''" as text _col(26) "`RC'" _col(44) "`RCg0'" _col(62) "`RCg1'"
}
di as result _col(10) "{hline 70}"
}
else if "`group'" == "" {
di
di %~60s as result "SUMMARY"
di as result _col(10) "{hline 40}"
di _col(10) "Item" _col(36) "Recalibration"
di _col(10) "{hline 40}"
forvalues j=1/`nbitems' {
local RC
if dif_rc[`j',3] != . {
if `nbmoda_`j'' > 2 {
if (dif_rc[`j',6]!=. & dif_rc[`j',6] != 0) {
local RC "Uniform"
}
if (dif_rc[`j',6] == 0) {
local RC "Non-uniform"
}
}
else {
local RC " X "
}
}
di as result _col(10) "``j''" as text _col(38) "`RC'"
}
di as result _col(10) "{hline 40}"
di
}
matrix dif_detect = J(1,`nbitems',.)
local numdif=1 local numdif=1
forvalues j=1/`nbitems' { forvalues j=1/`nbitems' {
if dif_rc[`j',1] != . { if dif_rc[`j',1] != . {
matrix dif_detect[1,`numdif']=`j' matrix dif_detect[1,`numdif']=`j'
if dif_rc[`j',2] == 0 {
matrix dif_detect[1,`nbitems'+`numdif']=0
}
if dif_rc[`j',2] != 0 {
matrix dif_detect[1,`nbitems'+`numdif']=1
}
local numdif = `numdif'+1 local numdif = `numdif'+1
} }
} }

@ -53,7 +53,7 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
else { else {
local nbdif=3 local nbdif=3
} }
local taillemat=`nbitems'+3+`nbdif' local taillemat=2*`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.) mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'" di "Scenario `s'`scen' / N=`Nnn'"
@ -65,27 +65,28 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
qui keep if replication==`k' qui keep if replication==`k'
qui rosali_original item1-item`nbitems' item1-item`nbitems', group(TT) qui rosali_original item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems) qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' { local nbitems2 = 2*`nbitems'
forvalues jj=1/`nbitems2' {
qui mat outmat[`k',`jj']=resmat[1,`jj'] qui mat outmat[`k',`jj']=resmat[1,`jj']
} }
qui mat outmat[`k',`nbitems'+1]=`Nn' qui mat outmat[`k',2*`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems' qui mat outmat[`k',2*`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif' qui mat outmat[`k',2*`nbitems'+3]=`nbdif'
if (`nbdif' > 0) { if (`nbdif' > 0) {
qui levelsof dif1 qui levelsof dif1
local ldif1 = r(levels) local ldif1 = r(levels)
local diff1: word 1 of `ldif1' local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1' qui mat outmat[`k',2*`nbitems'+4]=`diff1'
if (`nbdif' > 1) { if (`nbdif' > 1) {
qui levelsof dif2 qui levelsof dif2
local ldif2 = r(levels) local ldif2 = r(levels)
local diff2: word 1 of `ldif2' local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2' qui mat outmat[`k',2*`nbitems'+5]=`diff2'
if (`nbdif' > 2) { if (`nbdif' > 2) {
qui levelsof dif3 qui levelsof dif3
local ldif3 = r(levels) local ldif3 = r(levels)
local diff3: word 1 of `ldif3' local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3' qui mat outmat[`k',2*`nbitems'+6]=`diff3'
} }
} }
} }
@ -137,7 +138,7 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
else { else {
local nbdif=3 local nbdif=3
} }
local taillemat=`nbitems'+3+`nbdif' local taillemat=2*`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.) mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'" di "Scenario `s'`scen' / N=`Nnn'"
@ -149,27 +150,28 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
qui keep if replication==`k' qui keep if replication==`k'
qui rosali_nobf item1-item`nbitems' item1-item`nbitems', group(TT) qui rosali_nobf item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems) qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' { local nbitems2 = 2*`nbitems'
forvalues jj=1/`nbitems2' {
qui mat outmat[`k',`jj']=resmat[1,`jj'] qui mat outmat[`k',`jj']=resmat[1,`jj']
} }
qui mat outmat[`k',`nbitems'+1]=`Nn' qui mat outmat[`k',2*`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems' qui mat outmat[`k',2*`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif' qui mat outmat[`k',2*`nbitems'+3]=`nbdif'
if (`nbdif' > 0) { if (`nbdif' > 0) {
qui levelsof dif1 qui levelsof dif1
local ldif1 = r(levels) local ldif1 = r(levels)
local diff1: word 1 of `ldif1' local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1' qui mat outmat[`k',2*`nbitems'+4]=`diff1'
if (`nbdif' > 1) { if (`nbdif' > 1) {
qui levelsof dif2 qui levelsof dif2
local ldif2 = r(levels) local ldif2 = r(levels)
local diff2: word 1 of `ldif2' local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2' qui mat outmat[`k',2*`nbitems'+5]=`diff2'
if (`nbdif' > 2) { if (`nbdif' > 2) {
qui levelsof dif3 qui levelsof dif3
local ldif3 = r(levels) local ldif3 = r(levels)
local diff3: word 1 of `ldif3' local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3' qui mat outmat[`k',2*`nbitems'+6]=`diff3'
} }
} }
} }
@ -221,7 +223,7 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
else { else {
local nbdif=3 local nbdif=3
} }
local taillemat=`nbitems'+3+`nbdif' local taillemat=2*`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.) mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'" di "Scenario `s'`scen' / N=`Nnn'"
@ -233,27 +235,28 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
qui keep if replication==`k' qui keep if replication==`k'
qui rosali_nolrt item1-item`nbitems' item1-item`nbitems', group(TT) qui rosali_nolrt item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems) qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' { local nbitems2 = 2*`nbitems'
forvalues jj=1/`nbitems2' {
qui mat outmat[`k',`jj']=resmat[1,`jj'] qui mat outmat[`k',`jj']=resmat[1,`jj']
} }
qui mat outmat[`k',`nbitems'+1]=`Nn' qui mat outmat[`k',2*`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems' qui mat outmat[`k',2*`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif' qui mat outmat[`k',2*`nbitems'+3]=`nbdif'
if (`nbdif' > 0) { if (`nbdif' > 0) {
qui levelsof dif1 qui levelsof dif1
local ldif1 = r(levels) local ldif1 = r(levels)
local diff1: word 1 of `ldif1' local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1' qui mat outmat[`k',2*`nbitems'+4]=`diff1'
if (`nbdif' > 1) { if (`nbdif' > 1) {
qui levelsof dif2 qui levelsof dif2
local ldif2 = r(levels) local ldif2 = r(levels)
local diff2: word 1 of `ldif2' local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2' qui mat outmat[`k',2*`nbitems'+5]=`diff2'
if (`nbdif' > 2) { if (`nbdif' > 2) {
qui levelsof dif3 qui levelsof dif3
local ldif3 = r(levels) local ldif3 = r(levels)
local diff3: word 1 of `ldif3' local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3' qui mat outmat[`k',2*`nbitems'+6]=`diff3'
} }
} }
} }
@ -304,7 +307,7 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
else { else {
local nbdif=3 local nbdif=3
} }
local taillemat=`nbitems'+3+`nbdif' local taillemat=2*`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.) mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'" di "Scenario `s'`scen' / N=`Nnn'"
@ -316,27 +319,28 @@ adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_cust
qui keep if replication==`k' qui keep if replication==`k'
qui rosali_nolrt_nobf item1-item`nbitems' item1-item`nbitems', group(TT) qui rosali_nolrt_nobf item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems) qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' { local nbitems2 = 2*`nbitems'
forvalues jj=1/`nbitems2' {
qui mat outmat[`k',`jj']=resmat[1,`jj'] qui mat outmat[`k',`jj']=resmat[1,`jj']
} }
qui mat outmat[`k',`nbitems'+1]=`Nn' qui mat outmat[`k',2*`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems' qui mat outmat[`k',2*`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif' qui mat outmat[`k',2*`nbitems'+3]=`nbdif'
if (`nbdif' > 0) { if (`nbdif' > 0) {
qui levelsof dif1 qui levelsof dif1
local ldif1 = r(levels) local ldif1 = r(levels)
local diff1: word 1 of `ldif1' local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1' qui mat outmat[`k',2*`nbitems'+4]=`diff1'
if (`nbdif' > 1) { if (`nbdif' > 1) {
qui levelsof dif2 qui levelsof dif2
local ldif2 = r(levels) local ldif2 = r(levels)
local diff2: word 1 of `ldif2' local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2' qui mat outmat[`k',2*`nbitems'+5]=`diff2'
if (`nbdif' > 2) { if (`nbdif' > 2) {
qui levelsof dif3 qui levelsof dif3
local ldif3 = r(levels) local ldif3 = r(levels)
local diff3: word 1 of `ldif3' local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3' qui mat outmat[`k',2*`nbitems'+6]=`diff3'
} }
} }
} }

Loading…
Cancel
Save