GAMLj: Specifying Crossed vs. Nested Models?

Discuss the jamovi platform, possible improvements, etc.
Post Reply
Benmind
Posts: 1
Joined: Wed Feb 19, 2020 4:39 pm

GAMLj: Specifying Crossed vs. Nested Models?

Post by Benmind »

Dear Marcello,

Let me start by saying that I love the GAMLj module and Jamovi as a whole. Keep up the good work!

My question is about crossed vs. nested mixed model designs in GAMLj. In lme4 syntax, it is possible to specify whether to use crossed or nested mixed models when using 2 or more random intercepts.

For example, a crossed design (responses nested within 2 parallel clusters) would be this:

1) Y ~ 1 + X + ( 1 | ClusterA) + (1 | ClusterB)

While a nested design (Level 3 = Cluster B, Level 2 = Cluster A) would be this:

2) Y ~ 1 + X + ( 1 | ClusterB/ClusterA)

It seems as though GAMLj always employs the crossed syntax from model 1 above. Is there a way to explicitly specify nested models? Based on the discussion at https://stats.stackexchange.com/questio ... -specified, it seems that the workaround involves changing the ClusterA labels, but would it also be possible to specify this in the GAMLj menu to avoid this recoding?

Thanks again for your excellent platform and module!
User avatar
mcfanda@gmail.com
Posts: 460
Joined: Thu Mar 23, 2017 9:24 pm

Re: GAMLj: Specifying Crossed vs. Nested Models?

Post by mcfanda@gmail.com »

Hi (thanks for the encouraging words),
As you have already pointed out, the solution is re-coding. I really think that in this way the users have much more control (and maybe understanding) of what is going on. In GAMLj, one simply codes the clusters in a coherent way: Different groups, different codes. Whatever is the structure of the data, as long as one follows this rule, the model works.

In terms of data consistency, I would not encourage users to code as class=1 two different classes only because they are of different schools. Think what would you think of a dataset in which gender=1 means `men` in Denver and `women` in Tokyo!

From a practical point of view, ` Y ~ 1 + X + ( 1 | ClusterB/ClusterA) ` is equivalent to

Code: Select all

clusterX<-factor(100*(ClusterB)+ClusterA)
 Y ~ 1 + X + ( 1 | ClusterB)+( 1 | ClusterX) 
Thus, re-coding is not a big problem.

However, the notation `ClusterB/ClusterA` gets cumbersome when models get a bit more complex. Assume I want the intercepts and the slopes to vary across ClusterA but only the intercepts to vary across ClusterB. In GAMLj, you simply run
` Y ~ 1 + X + ( 1 | ClusterB)+( 1+X | ClusterX) `

The "slash" notation is much less intuitive, at least for me
Post Reply