Re: [MplusAutomation] parseMplus()

44 views
Skip to first unread message

Daniel Morillo Cuadrado

unread,
Jan 23, 2024, 5:39:04 AMJan 23
to Austin Johnson, MplusAutomation
I understand from your question that you are probably calling `mplusObject()` to create your Mplus model code. Let's say you create it and assign it to an object called `mp_model`; your code will look like, more or less:

```
mp_model <- mplusObject(...)
mp_fit <- mplusModeler(mp_model, ...)
```

If this is correct, I think you may have found a bug in how the `mplusObject()` function expands those weights (although I understand they wouldn't need to be expanded in the Mplus syntax actually, as that syntax itself is valid for a continuous range of variables).

What you can probably do is first create the syntax from the `mplusObject`, then parse it (the call to `createSyntax()` can already do this for you), and then write the syntax to a temporary file and run it with `runModels()` instead of `mplusModeler()` i.e.:

```
mp_model <- mplusObject(...)
mp_syntax <- createSyntax(mp_model, filename = "model.inp", check = TRUE, add = TRUE) # The last two arguments will make it call `parseMplus(mp_syntax, add = TRUE)` for you
mp_fit <- runModels("model.inp")
```

I haven't tested this syntax, but I hope it points you in the correct direction at least.

Daniel

El mar, 23 ene 2024 a las 0:15, Austin Johnson (<aus...@ucr.edu>) escribió:
Hi all,

I'm struggling to figure out how to integrate parseMplus() into my mplusObject() or mplusModeler() calls. I'm using a complex survey design dataset with 80 variables as replicate weights, and it seems that when the weights expand out from "W12T1-W12T80" to every single weight, I get a bunch of lines in my resulting Mplus syntax that do not end in a comma or semicolon. The function returns a warning stating that I should "Rerun with parseMplus(add = TRUE) to add semicolons to all lines". But...how/where do I integrate parseMplus(add = TRUE) into my code?

Thanks!
Austin Johnson

--
You received this message because you are subscribed to the Google Groups "MplusAutomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mplusautomati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mplusautomation/10e799e4-001a-4655-b5bb-314c04480045n%40googlegroups.com.

Joshua Wiley

unread,
Feb 28, 2024, 7:26:12 PMFeb 28
to Austin Johnson, MplusAutomation
It would be helpful to have an example, from which I may be able to figure out why and a solution :)

Claire Klein

unread,
Apr 11, 2024, 12:20:50 PMApr 11
to MplusAutomation
I'm also having difficulty with this and finding where in my code to include parseMplus() - this error is showing up on code that was previously running just fine! Does anyone have an example?

Thank you!


Reply all
Reply to author
Forward
0 new messages