Multi-group testing by sex and clustering by family

41 views
Skip to first unread message

tald

unread,
Nov 14, 2025, 8:01:31 AM (7 days ago) Nov 14
to lavaan

Hi all,

I’m fitting a bivariate latent change score (LCS) model in lavaan and want to test sex differences using multigroup (group = "sex") while accounting for family-level clustering (cluster = "family"). In my data, families can have members in both sex groups. Most families are singletons, with relatively little families with multiple siblings (about 15%).

My ideal workflow:

  • Fit multigroup models by sex (free vs. constrained parameters to compare specific paths)
  • Compare with chi-square difference tests 
  • Adjust standard errors and test statistics for family clustering

However, I’m running into challenges because clustering is not nested within group (the same family identification number can appear in both groups). When I try:


fit <- lavaan( model = lcs_model, data = dat, group = "sex", cluster = "family", estimator = "MLR", fixed.x = FALSE, missing = "fiml" )

Copy code

I get errors (e.g., “subscript out of bounds”), and more broadly I’m unsure whether lavaan supports this design when clusters span groups. I don't get the error when I use ML as estimator and remove the clustering argument completely, but then I have not dealt with family clustering when comparing sex groups.

I have considered using lavaan.survey but it is currently not available within my R environment. It would be a great help to receive some suggestions on how to deal with cross-group clustering in multigroup fits using lavaan. 

Thanks!

Edward Rigdon

unread,
Nov 14, 2025, 2:50:56 PM (6 days ago) Nov 14
to lav...@googlegroups.com
Thinking out loud...
     So most family groups are singletons, but sex for the singleton varies across families?
     You might think of your data as comprising three groups--male-only singleton, female-only singleton, and multiple respondents. Add a grouping variable for "type of family." Lavaan now allows different samples to have different models and different variables. You will just have to be careful in picking out which parameter estimates you want to equate, but you can make that easier with careful labeling.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lavaan/4d56c1d8-6e0c-42a6-adfb-ec08021af1afn%40googlegroups.com.

tald

unread,
Nov 17, 2025, 3:28:23 AM (4 days ago) Nov 17
to lavaan
Hi Edward,
Thanks for thinking along!
Although combining the sex grouping and family clustering into a grouping variable could be an idea, it might complicate the testing of sex differences because sex would still vary within the multiple respondents groups. I'm considering testing sex differences through testing equality constraints using lavTestWald (uses robust cluster-adjusted covariance matrix of the parameter estimates), and in this way keep estimator = "MLR" and cluster = "family", since anova() (likelihood-ratio chi-square differences) is not supported in lavaan for multigroup + clustering. If you have any additional suggestions or see any pitfalls with this approach, I’d be grateful for your advice!

Reply all
Reply to author
Forward
0 new messages