I got to know the MplusAutomation package until yesterday. I feel so excited after practicing some examples provided in the vignette. So gorgeous! Thanks to Dr. Hallquist and Dr. Wiley, your work makes us more effective when doing data analysis with Mplus.
However, I am wondering whether I can realize some functions with MplusAutomation. More specifically, is it possible for me to read some parameters in the MODEL RESULTS section and then display them on the screen and/or save them in a HTML file? For example, considering a scenario of testing a moderating effect. Usually we run a path analysis with y as the dependent variable, and x, m, xm_int, c1, c2, c3 as the independent variable. In the independent variables, x, m and xm_int are focal variables, while c1, c2 and c3 are control variables. After running the model successfully, is it possible for me to keep the coefficients of x, m and xm_int on y, while drop the coefficients of c1, c2 and c3 on y? Furthermore, is it possible for me to display the selected coefficients on the screen and/or save them into a HTML file showSummaryTable and HTMLSummaryTable do?
I have searched the archives of the list and found someone suggest the MODEL CONSTRAINT command in Mplus. However, because of my limited experience of programing with R, I don’t know how to read the new added parameters from output of Mplus to R. Moreover, in the vignette, the author repeatedly mentions that the extracted parameters of single or multiple models are stored in data.frame. I guess we can read the data.frame and save it as a HTML or other types of file. Do you have any ideas?
I am looking forward to your suggestions. Thanks!
Best,
Chuding
--
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 mplusautomation+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dear Dr. Wiley,
Thanks for your information. Here I would like to share with another solution:
First I label all the coefficients I focus on, thus Mplus will put them in the “New Additional Parameters” section. And then read this section to a data frame. Finally, I write the results to a CSV or TXT file. Hope it is useful to the community!
library(MplusAutomation)
res <- readModels("D:/Examples/me_34.out", recursive=TRUE)
d <- res$parameters$unstandardized
newpara <- paramExtract(d, "new")
newpara <- as.data.frame(print(newpara))
write.table(newpara, "newpara.txt", sep="\t", quote=FALSE, na="NA")
Dear colleagues,
I have another question: is it possible to give a unique number for each input file both in the filename and in the TITLE section? For example, I have two iterators: DV and IV. And for DV, I have 4 types of measures; while for IV, I have 8 types of measures. So totally I have 4*8 = 32 types of alternative combinations. I am wondering whether we can insert the number “1” into the filename and TITLE section of “DV1-IV1.inp”. Similarly, can we insert number “32” into the filename and TITLE section of “DV4-IV8.inp”? Do you have any ideas? Thanks!
Best,
Chuding
Dear Dr. Hallquist and colleagues,
My friend has helped me worked out the syntax. You may have a look in the attachment. Hope it is useful to the community.
It indeed works in this simple example. However, I encounter another problem. I am undertaking a multilevel SEM analysis. And the command in the MODEL section is a little bit complex. I copy the model template into the MplusObject section and modify it according to the format of this function. But it doesn’t work out the results automatically for two reasons. One is the syntax cannot define the variables in the dataset automatically; the other is the character numbers in some lines exceed 90. I try to define the variables manually, and try to put those lines exceeding 90 characters into two lines. But both attempts fail. Do you have any ideas?
Thanks!
Best,
Chuding