You are here

Variance components in two-level models

2 posts / 0 new
Last post
Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Variance components in two-level models
AttachmentSize
PDF icon test-2L-model.pdf219.77 KB

Hello all,

I want to estimate the variance components in a two-level model. The estimated variances seem correct when there is only one variable. However, the estimated variances appear incorrect when more than one variable. The observation is that the between-level variances are under-estimated, whereas the within-level variances are over-estimated.

Attached is an example with 1,000 level-2 units, each with 100 level-1 units. This ensures that sampling error does not play a critical role.

Did I do something wrong here? Thanks in advance.

Mike

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Hello all,

Hello all,

I just figured that I had made an error in the code.
Incorrect:

mxMatrix("Full", p, p, F, 1, name = "T", joinKey = "cluster", joinModel = "B", dimnames = list(man_W, lat_B)),

Correct:

mxMatrix("Diag", p, p, F, 1, name = "T", joinKey = "cluster", joinModel = "B", dimnames = list(man_W, lat_B)),

It works okay after correcting it. I have attached the updated version for the record.

Mike

File attachments: