Ordinal data syntax for simulateData()

698 views
Skip to first unread message

kma...@aol.com

unread,
Feb 15, 2013, 6:16:24 PM2/15/13
to lav...@googlegroups.com

The version history page states "simulateData() supports thresholds and creates ordinal data".  Where can I find an explanation of the syntax for specifying thresholds to simulate ordinal data?  Perhaps I am just not looking in the right place, but I am not finding it in the tutorial document or the version 5-11 reference manual.

Keith

yrosseel

unread,
Feb 17, 2013, 5:16:31 AM2/17/13
to lav...@googlegroups.com
On 02/16/2013 12:16 AM, kma...@aol.com wrote:
>
> The version history page states "simulateData() supports thresholds and
> creates ordinal data". Where can I find an explanation of the syntax
> for specifying thresholds to simulate ordinal data?

Nowhere I'm afraid. Once the 'categorical part' of lavaan has more or
less stabilized, I will write out full documentation.

Importantly, the implementation (for ordinal variables) has changed in
0.5-12 (which will be released next week, but you can install it by
typing in R):

install.packages("lavaan", repos="http://www.da.ugent.be", type="source")


To generate 'ordinal' data, you need to specify the threshold values.
For example:

pop.model <- ' f1 =~ u1 + u2 + u3
f2 =~ y4 + y5 + y6

u1 | 0*t1
u2 | -1.5*t1 + 0.1*t2 + 1.2*t3
u3 | -0.5*t1 + 0.5*t2
'

Here, u1, u2 and u3 are ordinal. u1 is binary, hence has only a single
threshold. u2 has 4 categories, and u3 has 3 categories. The thresholds
assume that the latent response variables follow a standardized normal
distribution. If no thresholds are defined, lavaan assumes the variable
is continuous.

When generating data, integers are used for the ordinal/binary
variables, but we do not explicitly set the 'ordered' flag.

> simulateData(model, sample.nobs=10)
u1 u2 u3 y4 y5 y6
1 2 4 3 -0.66477575 -0.2611165 -0.8238838
2 1 2 1 0.91950310 0.6385653 -1.0571208
3 1 2 1 0.62965216 2.3097330 0.9096156
4 2 3 3 -0.84389155 0.9806485 1.3678605
5 2 3 2 -0.03460044 -1.0926641 0.3323604
6 1 2 2 -3.47410196 -0.3391533 -1.7200381
7 1 2 2 0.01633944 -1.8826356 0.9946159
8 1 2 1 1.28558493 -1.2038462 -1.7161828
9 2 2 2 -0.85291397 -0.4449963 0.0316196
10 1 1 1 1.28784679 2.6771630 -1.0352630

Hope this helps,

Yves.

kma...@aol.com

unread,
Feb 18, 2013, 9:44:25 AM2/18/13
to lav...@googlegroups.com
Yves,
  Thanks for the detailed explanation.  That makes perfect sense.

Keith


Reply all
Reply to author
Forward
0 new messages