michaelhallquist/MplusAutomation — pull request #20 by patr1ckm (2014-05-15 22:25:17+00:00)
Title: Extract Additional Warnings and Errors about Estimation

Hi Michael and others -

I have here a first go at extracting the warnings and errors in the Mplus output file that typically come after the SUMMARY OF ANALYSIS. These errors are typically about how the estimation went. The motivation is that seeing these errors is really important to me typically, and I don't want to gloss over them in an automated analysis. My goal is to just provide the code here and start a discussion - you don't necessarily have to use it if you don't want to.

My solution works, but is hacky (forgive me!) It captures the messages before and after SUMMARY OF ANALYSIS by searching for any instances of the word WARNING. The same warnerr object is built in a similar way as before, and extended for a couple of cases.

My solution assumes the following (let me know if these aren't safe):
1. If the estimation terminated normally, I assumed that the section immediately following the errors was MODEL FIT INFORMATION. This is used to flag the line at which the errors end. This catches errors before and after "THE MODEL ESTIMATION TERMINATED NORMALLY" messages.

2. If the estimation did not terminate normally, I used "THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY" as a flag. Sadly, these are errors but don't use the word "ERROR". I used "PROBLEM INVOLVING PARAMETER x \n\n\n\n" as an end flag. This was the best I could come up with because in this case, MODEL FIT is not reported, but the parameter estimates typically are. I'd be open to better ideas here!

Limitations:
1. Some of the error messages are not flagged by WARNING or ERROR. When this occurs, the two messages are just combined into one.
2. Getting the error messages correct when the estimation did not terminate normally was a large pain because the flag was contained in the message itself. This made the indexing different, and I solved it by just using a bunch of conditional statements.
3. Limited testing - just a handful of mixture models that I have been working on, and the test case provided by mrronko.

Let me know what you think!