Created simirt.R

main
Corentin Choisy 1 year ago
parent dcd679a5aa
commit 59bc529e70

@ -429,7 +429,7 @@ if "`pcm'"==""|"`rsm1'"!="" {
local tmp:word `j' of `rsm2' local tmp:word `j' of `rsm2'
matrix `pcm'[`i',`=1+`j'']=`pcm'[`i',1]+`tmp' matrix `pcm'[`i',`=1+`j'']=`pcm'[`i',1]+`tmp'
} }
} }
} }
} }
} }
@ -476,7 +476,7 @@ forvalues i=1/`nbitems' {
} }
if "`covmatrix'"=="" { if "`covmatrix'"=="" {
tempname covmatrix tempname covmatrix
if `nbcov'==1 { if `nbcov'==1 {
matrix `covmatrix'=(`cov') matrix `covmatrix'=(`cov')
} }
@ -514,7 +514,7 @@ local names
forvalues d=1/`dim' { forvalues d=1/`dim' {
qui gen x`d'=invnorm(uniform()) qui gen x`d'=invnorm(uniform())
qui compress qui compress
local names `names' lt`d' local names `names' lt`d' /*En R: names <- c(names,paste('lt',d)) */
} }
matrix Chol=cholesky(corr(`covmatrix')) matrix Chol=cholesky(corr(`covmatrix'))
@ -530,8 +530,8 @@ forvalues d=1/`dim' {
qui replace lt`d'=lt`d'*sqrt(`covmatrix'[`d',`d'])+`matmu'[`d',1] qui replace lt`d'=lt`d'*sqrt(`covmatrix'[`d',`d'])+`matmu'[`d',1]
qui compress qui compress
} }
qui replace lt1=_n-`nbobs' if `graphobs' qui replace lt1=_n-`nbobs' if `graphobs'
qui replace lt1=(lt1-1001)/1000*4*sqrt(`covmatrix'[1,1])+`matmu'[1,1] if `graphobs' qui replace lt1=(lt1-1001)/1000*4*sqrt(`covmatrix'[1,1])+`matmu'[1,1] if `graphobs'
if `dim'==1&`group'!=0 { if `dim'==1&`group'!=0 {
if "`random'"=="" { if "`random'"=="" {
@ -674,14 +674,14 @@ if "`draw'"!=""|"`icc'"!=""|"`drawall'"!="" {
else { else {
local title3="`title'" local title3="`title'"
} }
graph twoway (line `icc`i'' lt1) if `graphobs', ylabel(0(1)`nbmodas') legend(off) ytitle("Expected response") title("`title3'") name(iccitem`i',replace) graph twoway (line `icc`i'' lt1) if `graphobs', ylabel(0(1)`nbmodas') legend(off) ytitle("Expected response") title("`title3'") name(iccitem`i',replace)
local hicc `hicc' (line `icc`i'' lt1) local hicc `hicc' (line `icc`i'' lt1)
label variable `icc`i'' "Item `i'" label variable `icc`i'' "Item `i'"
} }
graph twoway `hicc' if `graphobs', ylabel(0(1)`nbmodas') legend(on) ytitle("Expected response") title("Item Characteristic Curves") name(icc,replace) graph twoway `hicc' if `graphobs', ylabel(0(1)`nbmodas') legend(on) ytitle("Expected response") title("Item Characteristic Curves") name(icc,replace)
} }
} }
qui drop if `graphobs' qui drop if `graphobs'
/******************************************************************************** /********************************************************************************

Loading…
Cancel
Save