R analysis code complete
This commit is contained in:
@ -1,49 +1,54 @@
|
||||
*=================================================================================================================================================
|
||||
* Date : 2024-01-23
|
||||
* Stata version : Stata 18 SE
|
||||
*
|
||||
* This program analyses simulated data without DIF through a partial credit model
|
||||
*
|
||||
* ado-files needed : - pcm (version 5.5 October 25, 2023, available on gitea)
|
||||
*
|
||||
* outputs : for N=100
|
||||
*
|
||||
*
|
||||
*================================================================================================================================================
|
||||
*=================================================================================================================================================
|
||||
* Date : 2024-01-23
|
||||
* Stata version : Stata 18 SE
|
||||
*
|
||||
* This program analyses simulated data without DIF through a partial credit model
|
||||
*
|
||||
* ado-files needed : - pcm (version 5.5 October 25, 2023, available on gitea)
|
||||
*
|
||||
* outputs : for N=100
|
||||
*
|
||||
*
|
||||
*================================================================================================================================================
|
||||
|
||||
* Load pcm.ado
|
||||
adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/"
|
||||
* Load pcm.ado
|
||||
adopath+"/home/corentin/Documents/These/Recherche/Simulations/Modules/"
|
||||
|
||||
* Set output folder path
|
||||
local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/NoDIF/N100"
|
||||
local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N100"
|
||||
local Nn = 100
|
||||
* Set output folder path
|
||||
local path_data = "/home/corentin/Documents/These/Recherche/Simulations/Data/DIF/N100"
|
||||
local path_res = "/home/corentin/Documents/These/Recherche/Simulations/Analysis/NoDIF/N100"
|
||||
local Nn = 100
|
||||
|
||||
|
||||
*==========================
|
||||
* Scenarios with : J=4
|
||||
*==========================
|
||||
*==========================
|
||||
* Scenarios with : J=4
|
||||
*==========================
|
||||
|
||||
** Scenario 1: J = 4 items / M = 2 modalities
|
||||
** Scenario 1: J = 4 items / M = 2 modalities
|
||||
|
||||
* Scenario 1A : H_0 is TRUE
|
||||
* Scenario 1A : H_0 is TRUE
|
||||
|
||||
clear
|
||||
import delim "`path_data'/scenario_1A_100.csv", encoding(ISO-8859-2) case(preserve) clear
|
||||
rename TT tt
|
||||
clear
|
||||
import delim "`path_data'/scenario_5A_100.csv", encoding(ISO-8859-2) case(preserve) clear
|
||||
rename TT tt
|
||||
|
||||
|
||||
|
||||
keep if replication==1
|
||||
di `k'
|
||||
gsem (1.item1<-THETA@1)///
|
||||
(1.item2<-THETA@1)///
|
||||
(1.item3<-THETA@1)///
|
||||
(1.item4<-THETA@1)///
|
||||
(1.item5<-THETA@1)///
|
||||
(1.item6<-THETA@1)///
|
||||
(1.item7<-THETA@1)///
|
||||
(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent
|
||||
keep if replication==1
|
||||
di `k'
|
||||
* log using gsem.txt, text replace
|
||||
* Créer une matrice 1000xnbitems+1 (pour beta) à l'avance et populer chaque coefficient à la main à chaque itération
|
||||
* Créer une deuxième matrice et faire de même pour les std error
|
||||
gsem (1.item1<-THETA@1)///
|
||||
(1.item2<-THETA@1 tt)///
|
||||
(1.item3<-THETA@1)///
|
||||
(1.item4<-THETA@1)///
|
||||
(THETA<-tt), mlogit tol(0.01) iterate(500) latent(THETA) nocapslatent
|
||||
mat V=r(table)
|
||||
mat W=V[1..2,1...]
|
||||
putexcel set "W.xls", sheet("W") replace
|
||||
putexcel A1=matrix(W)
|
||||
* log close
|
||||
|
||||
|
||||
pcm item1 item2 item3 item4, categorical(tt)
|
||||
|
Reference in New Issue
Block a user