Corrected code for getting logs
This commit is contained in:
@ -8,11 +8,11 @@
|
||||
*
|
||||
*
|
||||
*================================================================================================================================================
|
||||
adopath+"/home/corentin/Documents/These/Recherche/ROSALI-SIM/Modules/rosali_custom"
|
||||
adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/rosali_custom"
|
||||
|
||||
|
||||
local N = "50 100 200 300"
|
||||
local ss = "1 2 3 4 5 6 7 8 9 10 11 1 13 14 15 16 17 18 19 20"
|
||||
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'
|
||||
@ -21,6 +21,7 @@ local N = "50 100 200 300"
|
||||
local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N`Nn'"
|
||||
}
|
||||
local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/ROSALI-DIF/N`Nn'"
|
||||
local path_log = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/ROSALI-DIF/log/"
|
||||
local scenarios = "A B C D E F G"
|
||||
if (`s' <= 4) {
|
||||
local scenarios = "A B C D E"
|
||||
@ -29,7 +30,7 @@ local N = "50 100 200 300"
|
||||
clear
|
||||
import delim "`path_data'/scenario_`s'`scen'_`Nn'.csv", encoding(ISO-8859-2) case(preserve) clear
|
||||
rename TT tt
|
||||
|
||||
log using "`path_log'/log_`s'`scen'_`Nn'.log", replace
|
||||
if (`s'<=2) {
|
||||
local nbitems=4
|
||||
}
|
||||
@ -63,9 +64,9 @@ local N = "50 100 200 300"
|
||||
local nbdif=3
|
||||
}
|
||||
* 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
|
||||
local taillemat=2*`nbitems'*`nbmoda'+`nbitems'+`nbdif'+2+1
|
||||
if (mod(`s',2)==0) {
|
||||
local taillemat=2*`nbitems'*`nbmoda'+`nbitems'+`nbitems'+`nbdif'+2
|
||||
local taillemat=2*`nbitems'*`nbmoda'+`nbitems'+`nbitems'+`nbdif'+2+1
|
||||
}
|
||||
local colna=""
|
||||
forvalues i=1/`nbitems' {
|
||||
@ -86,16 +87,20 @@ local N = "50 100 200 300"
|
||||
forvalues i=1/`nbdif' {
|
||||
local colna = "`colna'"+"real_dif_`i' "
|
||||
}
|
||||
local colna = "`colna'" + "beta " + "se_beta"
|
||||
|
||||
local colna = "`colna'" + "beta " + "se_beta " + "lrt_passed"
|
||||
|
||||
mat outmat = J(1000,`taillemat',.)
|
||||
mat colnames outmat= `colna'
|
||||
di "Scenario `s'`scen' / N=`Nnn'"
|
||||
forvalues k=1/1000 {
|
||||
if (mod(`k',100)==0) {
|
||||
di "`k'/1000"
|
||||
}
|
||||
forvalues k=1/10 {
|
||||
di "###################################################################################"
|
||||
di "###################################################################################"
|
||||
di "###################################################################################"
|
||||
di "Scenario `s'`scen' N=`Nn' ########## `k'/1000"
|
||||
di "###################################################################################"
|
||||
di "###################################################################################"
|
||||
di "###################################################################################"
|
||||
|
||||
preserve
|
||||
qui keep if replication==`k'
|
||||
|
||||
@ -253,10 +258,10 @@ local N = "50 100 200 300"
|
||||
|
||||
|
||||
* ROSALI
|
||||
qui rosali_original item1-item`nbitems' item1-item`nbitems', group(tt)
|
||||
rosali_original item1-item`nbitems' item1-item`nbitems', group(tt)
|
||||
qui mat resmat=r(difitems)
|
||||
local nbitems2 = 2*`nbitems'
|
||||
|
||||
mat lrt_passed = resmat[1,`nbitems2'+1]
|
||||
* Calculer le nbre d'items détectés
|
||||
local nbdetect = 0
|
||||
local stop = 0
|
||||
@ -329,7 +334,7 @@ local N = "50 100 200 300"
|
||||
local mod = "`mod'" + "(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent"
|
||||
}
|
||||
*calcul du modèle
|
||||
qui `mod'
|
||||
`mod'
|
||||
mat V=r(table)
|
||||
mat W=V[1..2,1...]
|
||||
|
||||
@ -372,8 +377,10 @@ local N = "50 100 200 300"
|
||||
}
|
||||
qui mat outmat[`k',colnumb(outmat,"beta")]=W[1,colnumb(W,"THETA:tt")]
|
||||
qui mat outmat[`k',colnumb(outmat,"se_beta")]=W[2,colnumb(W,"THETA:tt")]
|
||||
qui mat outmat[`k',colnumb(outmat,"lrt_passed")]=lrt_passed[1,1]
|
||||
restore
|
||||
}
|
||||
log close
|
||||
putexcel set "`path_res'/`s'`scen'_`Nn'_original.xls", sheet("outmat") replace
|
||||
putexcel A1=matrix(outmat), colnames
|
||||
}
|
||||
|
Reference in New Issue
Block a user