Of course, I can go around it and turn my factor variable into a sequence of dummy variables, and it works, but can lavaan accommodate ordered exogenous variables?
mod <- ' x1 + x2 ~ AGE
AGE =~ ageyr
ageyr ~~ 0*ageyr
AGE ~~ 1*AGE
'
summary(sem(mod, data = HolzingerSwineford1939, ordered = "ageyr", parameterization = "theta"))
for (i in 12:16) HolzingerSwineford1939[,paste0("age", i)] <- as.integer(HolzingerSwineford1939$ageyr == i)
mod <- ' x1 ~ b1_12*age12 + b1_13*age13 + b1_14*age14 + b1_15*age15 + b1_16*age16
## year 11 is reference group, so first slope is a 1-year effect.
'
con <- '## constrain other years to be a multiple of it
b1_13 == 2*b1_12
b1_14 == 3*b1_12
b1_15 == 4*b1_12
b1_16 == 5*b1_12
'
fit <- sem(mod, data = HolzingerSwineford1939)
lavTestWald(fit, constraints = con) # fail to reject H0 of linearityIf I would have adopted the 'theta' parametrization, of course, I obtain the thresholds,
what would be the procedure for testing group differences?
Peter,
Dummy coding doesn't hold order information, though. If this is a
question of interest, you're probably better off with a multiple-group
model and inequality constraints to keep the parameter estimates
moving in the same direction as the age groups.
Pat
On Sun, Jun 28, 2020 at 11:49 AM Peter Paprzycki
<peter.p...@gmail.com> wrote:
>
> Oh, thank you Terrence. My situation has four age group categories (ordered factor). I know I can obtain the thresholds and p-values associated with them. I am interested, however, in testing the differences in the four age groups with respect to the endogenous variables. So, this is why the adoption of the dummy variable approach would work (comparisons versus a reference group).
>
> Peter
>
> On Friday, June 26, 2020 at 6:15:41 PM UTC-4, Terrence Jorgensen wrote:
>>>
>>> If I would have adopted the 'theta' parametrization, of course, I obtain the thresholds,
>>
>>
>> You can (and by default, do) estimate thresholds also with the default "delta" parameterization. "theta" is merely necessary for residual variances to be model parameters, so that it can be fixed to zero for ageyr.
>>
>>> what would be the procedure for testing group differences?
>>
>>
>> differences in what?
>>
>> Terrence D. Jorgensen
>> Assistant Professor, Methods and Statistics
>> Research Institute for Child Development and Education, the University of Amsterdam
>> http://www.uva.nl/profile/t.d.jorgensen
>>
>
> --
> 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 lav...@googlegroups.com.
Dummy coding doesn't hold order information
con <-'b11 < b12b12 < b13b21 < b22b22 < b23b31 < b32b32 < b33b41 < b42b42 < b43'