michaelhallquist / MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.
82 stars 46 forks source link

The warning element of result list of readModels does not contain the warnings from Mplus #3

Closed mronkko closed 10 years ago

mronkko commented 11 years ago

Test case https://gist.github.com/mronkko/5478217

mronkko commented 11 years ago

To clarify, the output file contains the following section

THE MODEL ESTIMATION TERMINATED NORMALLY

 WARNING:  THE LATENT VARIABLE COVARIANCE MATRIX (PSI) IS NOT POSITIVE
 DEFINITE.  THIS COULD INDICATE A NEGATIVE VARIANCE/RESIDUAL VARIANCE FOR A
 LATENT VARIABLE, A CORRELATION GREATER OR EQUAL TO ONE BETWEEN TWO LATENT
 VARIABLES, OR A LINEAR DEPENDENCY AMONG MORE THAN TWO LATENT VARIABLES.
 CHECK THE TECH4 OUTPUT FOR MORE INFORMATION.
 PROBLEM INVOLVING VARIABLE C5.

I would expect the warning to be included in the warnings element of the result list.

patr1ckm commented 10 years ago

I agree with this. It would be really helpful to be able to extract estimation errors, and whether Mplus fixed any parameters or not.

patr1ckm commented 10 years ago

Here is another test case, where there is more verbose output before the estimation errors. Errors appear before and after THE MODEL ESTIMATION TERMINATED NORMALLY

https://gist.github.com/patr1ckm/2a933612ad2cea90e50e

michaelhallquist commented 10 years ago

Thanks for providing examples of the warnings and errors that were not being picked up. And thanks, too, patr1ckm for your code to include these in warnings and errors. I merged in your code and adapted it somewhat to be more general (and support some older output formats). This is still an imperfect solution because errors and warnings are printed irregularly and it is hard to demarcate the start and end (as well as whether a single blank line separates messages). Anyhow, I hope this is better than nothing!

sophiestallasch commented 5 years ago

Hello,

I would like to extract the warnings/ errors that appear in the UNIVARIATE SAMPLE STATISTICS section (directly below the UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS) when using DATA: TYPE = INDIVIDUAL in two- and threelevel analyses in Mplus 8 (e.g., THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES MAY NOT BE TRUSTWORTHY FOR SOME PARAMETERS DUE TO... or THE MODEL ESTIMATION HAS REACHED A SADDLE POINT... ). When using imputed data file lists with DATA: TYPE = IMPUTATION, the targeted warnings/ errors appear in the tech9 output which is not availble for TYPE = INDIVIDUAL. Unfortunately, with readModels(target = getwd(), what = "warn_err") only the warnings/ errors at the very beginning of the output file can be extracted.

Is there any possibility or work-around to achieve this? Any suggestion is welcome.

Many thanks in advance! Sophie