Code for the 4 rosali versions + analysis

main
Corentin Choisy 9 months ago
parent 70e53e7760
commit 34fd6ea608

@ -617,7 +617,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
di _dup(49) "_ " di _dup(49) "_ "
di di
di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1" *di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1"
********************************* *********************************
** MODEL B ** ** MODEL B **
@ -769,7 +769,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local diftestp=r(p) local diftestp=r(p)
if `diftestp'<0.05{ /*If pvalue(LRtest)<0.05 then step C*/ if `diftestp'<0.05{ /*If pvalue(LRtest)<0.05 then step C*/
di di
di as input "PROCESSING STEP C" *di as input "PROCESSING STEP C"
di di
/*test DIF pour chaque item*/ /*test DIF pour chaque item*/

@ -617,7 +617,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
di _dup(49) "_ " di _dup(49) "_ "
di di
di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1" *di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1"
********************************* *********************************
** MODEL B ** ** MODEL B **
@ -768,7 +768,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local diftestp = 1 local diftestp = 1
if `diftestp'<2{ /*If pvalue(LRtest)<0.05 then step C*/ if `diftestp'<2{ /*If pvalue(LRtest)<0.05 then step C*/
di di
di as input "PROCESSING STEP C" *di as input "PROCESSING STEP C"
di di
/*test DIF pour chaque item*/ /*test DIF pour chaque item*/

@ -617,7 +617,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
di _dup(49) "_ " di _dup(49) "_ "
di di
di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1" *di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1"
********************************* *********************************
** MODEL B ** ** MODEL B **
@ -768,7 +768,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local diftestp = 1 local diftestp = 1
if `diftestp'<2{ /*If pvalue(LRtest)<0.05 then step C*/ if `diftestp'<2{ /*If pvalue(LRtest)<0.05 then step C*/
di di
di as input "PROCESSING STEP C" *di as input "PROCESSING STEP C"
di di
/*test DIF pour chaque item*/ /*test DIF pour chaque item*/

@ -617,7 +617,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
di _dup(49) "_ " di _dup(49) "_ "
di di
di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1" *di as input "PART 1: DETECTION OF DIFFERENCE IN ITEM DIFFICULTIES BETWEEN GROUPS AT TIME 1"
********************************* *********************************
** MODEL B ** ** MODEL B **
@ -769,7 +769,7 @@ if "`group'"!="" & "`nodif'"=="" { // PARTIE 1 = Slmt si option group & pas de "
local diftestp=r(p) local diftestp=r(p)
if `diftestp'<0.05{ /*If pvalue(LRtest)<0.05 then step C*/ if `diftestp'<0.05{ /*If pvalue(LRtest)<0.05 then step C*/
di di
di as input "PROCESSING STEP C" *di as input "PROCESSING STEP C"
di di
/*test DIF pour chaque item*/ /*test DIF pour chaque item*/

@ -0,0 +1,349 @@
*=================================================================================================================================================
* Date : 2024-03-04
* Stata version : Stata 18 SE
*
* This program evaluates DIF detection performance for multiple ROSALI versions
*
* ado-files needed : - rosali_nolrt, rosali_nobf, rosali_nolrt_nobf, rosali_original
*
*
*================================================================================================================================================
* Load pcm.ado
adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_custom"
************************************************** Version 1: original
local N = "50 300"
local ss = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
foreach s in `ss' {
foreach Nnn in `N' {
local Nn = `Nnn'
local path_data = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Data/N`Nn'"
local path_res = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Analysis/original/N`Nn'"
local scenarios = "A B C"
foreach scen in `scenarios' {
clear
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
if (`s'<=2) {
local nbitems=4
}
else if (`s'<=4) {
local nbitems=7
}
else if (`s'<=12) {
local nbitems=4
}
else {
local nbitems=7
}
if (`s'<=4) {
local nbdif=0
}
else if (`s'<=8) {
local nbdif=1
}
else if (`s'<=12) {
local nbdif=2
}
else {
local nbdif=3
}
local taillemat=`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'"
forvalues k=1/1000 {
if (mod(`k',100)==0) {
di "`k'/1000"
}
preserve
qui keep if replication==`k'
qui rosali_original item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' {
qui mat outmat[`k',`jj']=resmat[1,`jj']
}
qui mat outmat[`k',`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif'
if (`nbdif' > 0) {
qui levelsof dif1
local ldif1 = r(levels)
local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1'
if (`nbdif' > 1) {
qui levelsof dif2
local ldif2 = r(levels)
local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2'
if (`nbdif' > 2) {
qui levelsof dif3
local ldif3 = r(levels)
local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3'
}
}
}
restore
}
putexcel set "`path_res'/`s'`scen'_`Nn'_original.xls", sheet("outmat") replace
putexcel A1=matrix(outmat), colnames
}
}
}
************************************************** Version 2: noBF
local N = "50 300"
local ss = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
foreach s in `ss' {
foreach Nnn in `N' {
local Nn = `Nnn'
local path_data = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Data/N`Nn'"
local path_res = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Analysis/noBF/N`Nn'"
local scenarios = "A B C"
foreach scen in `scenarios' {
clear
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
if (`s'<=2) {
local nbitems=4
}
else if (`s'<=4) {
local nbitems=7
}
else if (`s'<=12) {
local nbitems=4
}
else {
local nbitems=7
}
if (`s'<=4) {
local nbdif=0
}
else if (`s'<=8) {
local nbdif=1
}
else if (`s'<=12) {
local nbdif=2
}
else {
local nbdif=3
}
local taillemat=`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'"
forvalues k=1/1000 {
if (mod(`k',100)==0) {
di "`k'/1000"
}
preserve
qui keep if replication==`k'
qui rosali_nobf item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' {
qui mat outmat[`k',`jj']=resmat[1,`jj']
}
qui mat outmat[`k',`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif'
if (`nbdif' > 0) {
qui levelsof dif1
local ldif1 = r(levels)
local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1'
if (`nbdif' > 1) {
qui levelsof dif2
local ldif2 = r(levels)
local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2'
if (`nbdif' > 2) {
qui levelsof dif3
local ldif3 = r(levels)
local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3'
}
}
}
restore
}
putexcel set "`path_res'/`s'`scen'_`Nn'_noBF.xls", sheet("outmat") replace
putexcel A1=matrix(outmat), colnames
}
}
}
************************************************** Version 3: noLRT
local N = "50 300"
local ss = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
foreach s in `ss' {
foreach Nnn in `N' {
local Nn = `Nnn'
local path_data = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Data/N`Nn'"
local path_res = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Analysis/noLRT/N`Nn'"
local scenarios = "A B C"
foreach scen in `scenarios' {
clear
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
if (`s'<=2) {
local nbitems=4
}
else if (`s'<=4) {
local nbitems=7
}
else if (`s'<=12) {
local nbitems=4
}
else {
local nbitems=7
}
if (`s'<=4) {
local nbdif=0
}
else if (`s'<=8) {
local nbdif=1
}
else if (`s'<=12) {
local nbdif=2
}
else {
local nbdif=3
}
local taillemat=`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'"
forvalues k=1/1000 {
if (mod(`k',100)==0) {
di "`k'/1000"
}
preserve
qui keep if replication==`k'
qui rosali_nolrt item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' {
qui mat outmat[`k',`jj']=resmat[1,`jj']
}
qui mat outmat[`k',`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif'
if (`nbdif' > 0) {
qui levelsof dif1
local ldif1 = r(levels)
local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1'
if (`nbdif' > 1) {
qui levelsof dif2
local ldif2 = r(levels)
local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2'
if (`nbdif' > 2) {
qui levelsof dif3
local ldif3 = r(levels)
local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3'
}
}
}
restore
}
putexcel set "`path_res'/`s'`scen'_`Nn'_noLRT.xls", sheet("outmat") replace
putexcel A1=matrix(outmat), colnames
}
}
}
************************************************** Version 4: noLRT noBF
local N = "50 300"
local ss = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
foreach s in `ss' {
foreach Nnn in `N' {
local Nn = `Nnn'
local path_data = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Data/N`Nn'"
local path_res = "/home/corentin/Documents/These/Recherche/ROSALI-SIM/Analysis/noLRTnoBF/N`Nn'"
local scenarios = "A B C"
foreach scen in `scenarios' {
clear
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
if (`s'<=2) {
local nbitems=4
}
else if (`s'<=4) {
local nbitems=7
}
else if (`s'<=12) {
local nbitems=4
}
else {
local nbitems=7
}
if (`s'<=4) {
local nbdif=0
}
else if (`s'<=8) {
local nbdif=1
}
else if (`s'<=12) {
local nbdif=2
}
else {
local nbdif=3
}
local taillemat=`nbitems'+3+`nbdif'
mat outmat = J(1000,`taillemat',.)
di "Scenario `s'`scen' / N=`Nnn'"
forvalues k=1/1000 {
if (mod(`k',100)==0) {
di "`k'/1000"
}
preserve
qui keep if replication==`k'
qui rosali_nolrt_nobf item1-item`nbitems' item1-item`nbitems', group(TT)
qui mat resmat=r(difitems)
forvalues jj=1/`nbitems' {
qui mat outmat[`k',`jj']=resmat[1,`jj']
}
qui mat outmat[`k',`nbitems'+1]=`Nn'
qui mat outmat[`k',`nbitems'+2]=`nbitems'
qui mat outmat[`k',`nbitems'+3]=`nbdif'
if (`nbdif' > 0) {
qui levelsof dif1
local ldif1 = r(levels)
local diff1: word 1 of `ldif1'
qui mat outmat[`k',`nbitems'+4]=`diff1'
if (`nbdif' > 1) {
qui levelsof dif2
local ldif2 = r(levels)
local diff2: word 1 of `ldif2'
qui mat outmat[`k',`nbitems'+5]=`diff2'
if (`nbdif' > 2) {
qui levelsof dif3
local ldif3 = r(levels)
local diff3: word 1 of `ldif3'
qui mat outmat[`k',`nbitems'+6]=`diff3'
}
}
}
restore
}
putexcel set "`path_res'/`s'`scen'_`Nn'_noLRT_noBF.xls", sheet("outmat") replace
putexcel A1=matrix(outmat), colnames
}
}
}
Loading…
Cancel
Save