permuteMeasEq / lavaan object

36 vues
Accéder directement au premier message non lu

Christian Arnold

non lue,
8 sept. 2022, 10:54:3008/09/2022
à lavaan
Hi,

I have previously assumed that I can fit a lavaan object with the model syntax or with a parameter table. In principle this seems to work, but the permuteMeasEq function produces an error when I pass a lavaan object that has been fitted with a parameter table. A (rather meaningless) example is attached below. Is there something I need to be aware of when passing such an object to permuteMeasEq, am I just doing something wrong, is it perhaps a version issue or is this a bug?

Best

Christian


library(lavaan)
library(semTools)


HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '



fit <- cfa(HS.model, data = HolzingerSwineford1939, group = "school")
permuteMeasEq(nPermute = 10, con = fit)


fit.pt <- cfa(parTable(fit), data = HolzingerSwineford1939, group = "school")
permuteMeasEq(nPermute = 10, con = fit.pt)

Terrence Jorgensen

non lue,
9 sept. 2022, 08:36:0309/09/2022
à lavaan
Try saving the parameter table to an object that the function can find in your workspace, instead of arbitrarily calling the parTable() function on the fly.

PT <- parTable(fit)
fit.pt <- cfa(PT, data = HolzingerSwineford1939, group = "school")

Does that work?

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Christian Arnold

non lue,
9 sept. 2022, 16:17:3909/09/2022
à lav...@googlegroups.com
Hi Terrence, 

that works. Many thanks for that! It's a bit hard to understand why permuteMeasEq needs to dive so deep into the R environment logic. When I call your solution with do.call, I also get unsurpringly an error. Anyway, I'm sure there is a workaround. Thanks again!

Best

Christian 

From: lav...@googlegroups.com <lav...@googlegroups.com> on behalf of Terrence Jorgensen <tjorge...@gmail.com>
Sent: Friday, September 9, 2022 2:36:03 PM
To: lavaan <lav...@googlegroups.com>
Subject: Re: permuteMeasEq / lavaan object
 
--
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 on the web visit https://groups.google.com/d/msgid/lavaan/cd969c0e-0e0f-4abf-ba12-3b9f2b7cebbbn%40googlegroups.com.
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message