Updated simirt.R

This commit is contained in:
2023-12-26 17:08:12 +01:00
parent a82848938e
commit b97d14840b
2 changed files with 212 additions and 3 deletions

View File

@ -151,6 +151,8 @@ if (`group'!=0|`deltagroup'!=0)&`dim'!=1 {
exit
}
if "`prefix'"=="" {
local prefix item
}
@ -172,6 +174,17 @@ else {
local prefix`d' `prefix'`tmp'
}
}
if "`covmatrix'"=="" {
tempname covmatrix2
local nbcov:word count `cov'
@ -191,6 +204,15 @@ if "`covmatrix'"=="" {
}
matrix `covmatrix2'=(`cov')
}
else if `dim'==2 {
if `nbcov'!=3&`nbcov'>0 {
di in red "You simulate two dimensions. You must indicate exactly 3 values in the {hi:cov} option (Variance of the first simulated latent trait, Variance of the second simulated latent trait, Covariance between the two simulated latent traits)."
@ -222,6 +244,13 @@ if "`covmatrix'"=="" {
local covmatrix `covmatrix2'
}
local nbmu:word count `mu'
if `nbmu'!=`dim'&`nbmu'!=0 {
di in red "You must indicate as many values in the {hi:mu} option as the number of dimension(s) (`dim')"
@ -316,6 +345,10 @@ while $seed>2^31-1 {
qui set seed $seed
if "`typediff'"=="uniform" {
if `nbdiff'==`=`dim'*2+1' {
local min`d':word `=(`d'-1)*2+2' of `diff'
@ -336,6 +369,14 @@ if "`typediff'"=="uniform" {
}
}
}
else if "`typediff'"=="gauss" {
if `nbdiff'==`=`dim'*2+1' {
forvalues d=1/`dim' {
@ -363,6 +404,12 @@ else if "`typediff'"=="gauss" {
}
}
forvalues d=1/`dim' {
if "`rsm`d''"!="" {
local nbrsm`d':word count `rsm`d''