Closed aaronpeikert closed 6 years ago
Hi, One can specify thenorder of groups using the “group.label” argument within lavaan()/cfa(). One can just add, for instance, “...group=“gender”, group.label=c(“female”,”male”)...” if you want ‘female’ to be the first group. Best,
Thank you! Sorry, but I now realized it was a RTFM case. As the documentation of lavaan()
states
group.label: A character vector. The user can specify which group (or factor) levels need to be selected from the grouping variable, and in which order. If missing, all grouping levels are selected, in the order as they appear in the data.
Hello Yve, I am confused about how the order of groups is determent. It seems like, it is in the order in which the groups appear in the data. That don't make to much sense to me, because in most cases the order of rows is irrelevant. However instead I expected it to be according to the order of the levels of the factor of the group variable, or that it can be specified directly.
Example (also attached):
Setup
Simulation
Simulate some data with different groups.
Generate Models
Fit for all
Fit with groups
Variable unchanged
Varaible Factor reordered
First Person different Group