Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • A problem with runmplus_load_savedata.

    Dear Statalist,

    I am trying to use the runmplus to generate a confirmatory factor analysis and encountered an error with runmplus_load_savedata which I did not understand at all.

    The codes ran perfectly. But after some respondents were dropped, an error occurred after runmplus_load_savedata.
    The codes remain the same; the only change was that I deleted some respondents. The variables that I used to drop those respondents were not involved in runmplus codes.

    Code:
    . use temp1, clear 
    
    . qui runmplus s007   d018 d022 d057 d059 , idvariable(s007)  ///
    >   categorical(d018 d022 d057 d059) /// 
    >   ANALYSIS(TYPE = general; ) model(f1 by d018 d022 d057 d059) ///
    >   savedata(save=fscores; file=c:\trash\trash.dat) savelogfile(c:\trash\trash)
    
    . runmplus_load_savedata , out(c:/trash/trash.out) clear
    The case in which some respondents were dropped

    Code:
    . use temp1, clear 
    
    . keep if s003==50  | x048==356003 | x048==356004 | x048==356008 | x048==356011 | ///
    >  x048==356017 
    (1303 observations deleted)
    
    . qui runmplus s007   d018 d022 d057 d059 , idvariable(s007)  ///
    >   categorical(d018 d022 d057 d059) /// 
    >   ANALYSIS(TYPE = general; ) model(f1 by d018 d022 d057 d059) ///
    >   savedata(save=fscores; file=c:\trash\trash.dat) savelogfile(c:\trash\trash)
    
    . runmplus_load_savedata , out(c:/trash/trash.out) clear
    invalid syntax
    r(198);
    
    end of do-file
    I have read the help files many times and still have not got a clue.
    I appreciate any suggestions on why the error happened and how to fix it.

    PS: I am using Stata 13 MP, and the package runmplus is up to date.

  • #2
    I'd guess this is a programming problem in the runmplus package: somehow your data has a combination of characteristics runmplus did not expect, and that caused runmplus to create and execute an incorrect Stata command that had a syntax error. That is, I don't think the "syntax error" is on your part, but rather on the part of the author of runmplus.

    The help file for the various runmplus commands gives the author's name and email address; you might try contacting him directly.

    Comment


    • #3
      Hi Lisowski,

      Thank you for your reply. I have reported this issue to the author.

      Regards,
      Min

      Comment


      • #4
        Why not fit the model in Stata directly? Also, remember that file paths in Stata are case sensitive, so you may want to make sure the file path is correctly entered including the casing of the letters.

        Comment


        • #5
          Thanks Min Zhang, I advise that MPLUS does have some special characteristics for Categorical variables but if the vars were yes/no, then those would not have much added value over the STATA version. If the variables are Likert Scales then RUNMPLUS will have a special value. Secondly, re failure on the 2nd try, it is like that the Log file of Mplus, which is sitting inside the STATA log file, will show you the 2nd Run didn't work. As such, (it didn't work because of too few cases, did not converge, too few bits of data, or a zero-cell problem), there is no scores file for the 2nd command to seek. If you can widen the range of Manifest Vars to 6 or 7, it will be a stronger factor, converge, and then the 2nd program which has fewer cases will not fail.

          Comment


          • #6
            Hi, Min Zhang:

            Several thoughts:

            (1) Check an earlier version of Stata:

            I'd go back to an earlier version of Stata to see if that's the problem; I know the authors have more recently relied on R, so the updates may not be compatible with Stata 13. Runmplus came out in 2010, so that may be part of the issue.

            (2) Check if this is a problem within Mplus.

            I'd go back to the Mplus interface and the model there. Are you encountering problems there? Also, are you using the latest version of Mplus?

            (3) As others have pointed out, why not use Stata?

            Alan Acock's book (link) has a good example of CFA in the first chapter, if I recall correctly.

            (4) Re: the authors:

            I won't speak on behalf the authors formally. However, I've spoken with Rich Jones and know they're using the lavaan package in R as a wrapper for Mplus. If you go to the Mplus website you'll find the R wrapper advertised there. Therefore, some of these issues may be related to compatibility. Also, just FYI, the correspondence of the authors may not be up-to-date.

            (5) Re: CFA

            Having worked with several stat packages, including Mplus and Latent GOLD, I've found that latent variable modeling using the Latent GOLD software is far faster, more reliable, and more intuitive (I'm a bit biased, however, but this was borne out in the crucible of research!). This url provides information on Latent GOLD 5.1, which just came out; again, depending on other analyses, this may work for you. That said, for more simple analyses, Stata may well suffice, and it's worth it (in my view) to check out updating to Stata 14.

            Nathan E. Fosse, PhD
            [email protected]

            Comment


            • #7
              I have received the author's reply email and, as he asked, posted the runmplus results of the first successful run.

              Code:
              . 
              .  runmplus s007 d018 d022 d057 d059 , idvariable(s007)  ///
              >   categorical(d018 d022 d057 d059) /// 
              >   ANALYSIS(TYPE = general; ) model(f1 by d018 d022 d057 d059;) ///
              >   savedata(save=fscores; file=c:\trash\temp2.dat) savelogfile(c:\trash\trash)
              THE MODEL ESTIMATION TERMINATED NORMALLY
              Mplus VERSION 6.12
              MUTHEN & MUTHEN
              09/08/2015   1:45 PM
              
              INPUT INSTRUCTIONS
              
                TITLE:
                  Variable List -
              
                  s007 :
                  d018 :
                  d022 :
                  d057 :
                  d059 :
              
                DATA:
                  FILE = __000001.dat ;
                VARIABLE:
                  NAMES =
                    s007 d018 d022 d057 d059 ;
                  MISSING ARE ALL (-9999) ;
                  CATEGORICAL =
                    d018
                    d022
                    d057
                    d059
                    ;
                  IDVARIABLE = s007 ;
                ANALYSIS:
                OUTPUT:
                SAVEDATA:
                save=fscores ;
                file=c:\trash\temp2.dat  ;
              
                MODEL:
                f1 by d018 d022 d057 d059 ;
              
              
              
              
              INPUT READING TERMINATED NORMALLY
              
              
              
              
              Variable List -
              
              s007 :
              d018 :
              d022 :
              d057 :
              d059 :
              
              SUMMARY OF ANALYSIS
              
              Number of groups                                                 1
              Number of observations                                        3461
              
              Number of dependent variables                                    4
              Number of independent variables                                  0
              Number of continuous latent variables                            1
              
              Observed dependent variables
              
                Binary and ordered categorical (ordinal)
                 D018        D022        D057        D059
              
              Continuous latent variables
                 F1
              
              Variables with special functions
              
                ID variable           S007
              
              Estimator                                                    WLSMV
              Maximum number of iterations                                  1000
              Convergence criterion                                    0.500D-04
              Maximum number of steepest descent iterations                   20
              Maximum number of iterations for H1                           2000
              Convergence criterion for H1                             0.100D-03
              Parameterization                                             DELTA
              
              Input data file(s)
                __000001.dat
              
              Input data format  FREE
              
              
              SUMMARY OF DATA
              
                   Number of missing data patterns            15
              
              
              COVARIANCE COVERAGE OF DATA
              
              Minimum covariance coverage value   0.100
              
              
                   PROPORTION OF DATA PRESENT
              
              
                         Covariance Coverage
                            D018          D022          D057          D059
                            ________      ________      ________      ________
               D018           0.984
               D022           0.905         0.917
               D057           0.851         0.812         0.863
               D059           0.901         0.858         0.834         0.914
              
              
              UNIVARIATE PROPORTIONS AND COUNTS FOR CATEGORICAL VARIABLES
              
                  D018
                    Category 1    0.062      210.000
                    Category 2    0.938     3194.000
                  D022
                    Category 1    0.866     2750.000
                    Category 2    0.134      425.000
                  D057
                    Category 1    0.183      546.000
                    Category 2    0.288      862.000
                    Category 3    0.359     1074.000
                    Category 4    0.169      506.000
                  D059
                    Category 1    0.229      723.000
                    Category 2    0.422     1333.000
                    Category 3    0.275      869.000
                    Category 4    0.075      237.000
              
              
              
              THE MODEL ESTIMATION TERMINATED NORMALLY
              
              
              
              MODEL FIT INFORMATION
              
              Number of Free Parameters                       12
              
              Chi-Square Test of Model Fit
              
                        Value                             38.422*
                        Degrees of Freedom                     2
                        P-Value                           0.0000
              
              *   The chi-square value for MLM, MLMV, MLR, ULSMV, WLSM and WLSMV cannot be used
                  for chi-square difference testing in the regular way.  MLM, MLR and WLSM
                  chi-square difference testing is described on the Mplus website.  MLMV, WLSMV,
                  and ULSMV difference testing is done using the DIFFTEST option.
              
              RMSEA (Root Mean Square Error Of Approximation)
              
                        Estimate                           0.073
                        90 Percent C.I.                    0.054  0.093
                        Probability RMSEA <= .05           0.026
              
              CFI/TLI
              
                        CFI                                0.761
                        TLI                                0.282
              
              Chi-Square Test of Model Fit for the Baseline Model
              
                        Value                            158.215
                        Degrees of Freedom                     6
                        P-Value                           0.0000
              
              WRMR (Weighted Root Mean Square Residual)
              
                        Value                              1.629
              
              
              
              MODEL RESULTS
              
                                                                  Two-Tailed
                                  Estimate       S.E.  Est./S.E.    P-Value
              
               F1       BY
                  D018               1.000      0.000    999.000    999.000
                  D022              -0.659      0.151     -4.361      0.000
                  D057               2.166      0.857      2.528      0.011
                  D059               0.471      0.101      4.657      0.000
              
               Thresholds
                  D018$1            -1.541      0.034    -45.485      0.000
                  D022$1             1.108      0.028     39.590      0.000
                  D057$1            -0.905      0.027    -33.909      0.000
                  D057$2            -0.072      0.023     -3.147      0.002
                  D057$3             0.957      0.027     35.199      0.000
                  D059$1            -0.743      0.025    -30.121      0.000
                  D059$2             0.386      0.023     16.851      0.000
                  D059$3             1.440      0.033     43.505      0.000
              
               Variances
                  F1                 0.120      0.056      2.142      0.032
              
              
              R-SQUARE
              
                  Observed                   Residual
                  Variable        Estimate   Variance
              
                  D018               0.120      0.880
                  D022               0.052      0.948
                  D057               0.564      0.436
                  D059               0.027      0.973
              
              
              QUALITY OF NUMERICAL RESULTS
              
                   Condition Number for the Information Matrix              0.159E-03
                     (ratio of smallest to largest eigenvalue)
              
              
              SAMPLE STATISTICS FOR ESTIMATED FACTOR SCORES
              
              
                   SAMPLE STATISTICS
              
              
                         Means
                            F1
                            ________
               1             -0.001
              
              
                         Covariances
                            F1
                            ________
               F1             0.051
              
              
                         Correlations
                            F1
                            ________
               F1             1.000
              
              
              SAVEDATA INFORMATION
              
                Order and format of variables
              
                  D018           F10.3
                  D022           F10.3
                  D057           F10.3
                  D059           F10.3
                  S007           I7
                  F1             F10.3
              
                Save file
                  c:\trash\temp2.dat
              
                Save file format
                  4F10.3 I7 F10.3
              
                Save file record length    5000
              
              
                   Beginning Time:  13:45:22
                      Ending Time:  13:45:22
                     Elapsed Time:  00:00:00
              
              
              
              MUTHEN & MUTHEN
              3463 Stoner Ave.
              Los Angeles, CA  90066
              
              Tel: (310) 391-9971
              Fax: (310) 391-8971
              Web: www.StatModel.com
              Support: [email protected]
              
              Copyright (c) 1998-2011 Muthen & Muthen
              
              . runmplus_load_savedata , out(c:/trash/trash.out) clear

              Comment


              • #8
                Hi Min,

                Your issue is a mystery to me. Based on your MPlus log I can runmplus_load_savedata no problem with a dummy data set (log below).

                I would like to help you and figure out what is going wrong so we can put a fix in runmplus_load_savedata if it is needed.

                Maybe you could "log using foo.log, text replace" and "set trace on" and the run your "runmplus_load_savedata" and we could see where it's going wrong.

                Some other things:

                I see you are using MPlus 6.12, which is out-of-date. I keep runmplus current with MPlus. And when Mplus changes the structure and content of output files, the post-processing that is baked into runmplus and associated files may bomb out. So, you should keep your MPlus current. I don't think that's the issue, since I was able to read your OUT and read the associated DAT file. But...

                Also, I keep the version of runmplus and associated files on my AWS file server more up-to-date than the SSC, which although is a little easier for me to keep updated. Instructions are in the runmplus help file for getting your update from there.


                Rich

                PS Hi Nathan.

                PPS Runmplus and associated files should work with current versions of associated software (version 14 Stata, Version 7.31 Mplus), and on MAC/OS, other *NIX, and PC/Windows environments. If it does not please let me know.

                . clear

                . type c:\trash\temp2.dat
                12345678 22345678 32345678 42345678 1 5345678

                . type c:\trash\trash.out
                THE MODEL ESTIMATION TERMINATED NORMALLY
                Mplus VERSION 6.12
                MUTHEN & MUTHEN
                09/08/2015 1:45 PM

                INPUT INSTRUCTIONS

                TITLE:
                Variable List -

                s007 :
                d018 :
                d022 :
                d057 :
                d059 :

                DATA:
                FILE = __000001.dat ;
                VARIABLE:
                NAMES =
                s007 d018 d022 d057 d059 ;
                MISSING ARE ALL (-9999) ;
                CATEGORICAL =
                d018
                d022
                d057
                d059
                ;
                IDVARIABLE = s007 ;
                ANALYSIS:
                OUTPUT:
                SAVEDATA:
                save=fscores ;
                file=c:\trash\temp2.dat ;

                MODEL:
                f1 by d018 d022 d057 d059 ;




                INPUT READING TERMINATED NORMALLY




                Variable List -

                s007 :
                d018 :
                d022 :
                d057 :
                d059 :

                SUMMARY OF ANALYSIS

                Number of groups 1
                Number of observations 3461

                Number of dependent variables 4
                Number of independent variables 0
                Number of continuous latent variables 1

                Observed dependent variables

                Binary and ordered categorical (ordinal)
                D018 D022 D057 D059

                Continuous latent variables
                F1

                Variables with special functions

                ID variable S007

                Estimator WLSMV
                Maximum number of iterations 1000
                Convergence criterion 0.500D-04
                Maximum number of steepest descent iterations 20
                Maximum number of iterations for H1 2000
                Convergence criterion for H1 0.100D-03
                Parameterization DELTA

                Input data file(s)
                __000001.dat

                Input data format FREE


                SUMMARY OF DATA

                Number of missing data patterns 15


                COVARIANCE COVERAGE OF DATA

                Minimum covariance coverage value 0.100


                PROPORTION OF DATA PRESENT


                Covariance Coverage
                D018 D022 D057 D059
                ________ ________ ________ ________
                D018 0.984
                D022 0.905 0.917
                D057 0.851 0.812 0.863
                D059 0.901 0.858 0.834 0.914


                UNIVARIATE PROPORTIONS AND COUNTS FOR CATEGORICAL VARIABLES

                D018
                Category 1 0.062 210.000
                Category 2 0.938 3194.000
                D022
                Category 1 0.866 2750.000
                Category 2 0.134 425.000
                D057
                Category 1 0.183 546.000
                Category 2 0.288 862.000
                Category 3 0.359 1074.000
                Category 4 0.169 506.000
                D059
                Category 1 0.229 723.000
                Category 2 0.422 1333.000
                Category 3 0.275 869.000
                Category 4 0.075 237.000



                THE MODEL ESTIMATION TERMINATED NORMALLY



                MODEL FIT INFORMATION

                Number of Free Parameters 12

                Chi-Square Test of Model Fit

                Value 38.422*
                Degrees of Freedom 2
                P-Value 0.0000

                * The chi-square value for MLM, MLMV, MLR, ULSMV, WLSM and WLSMV cannot be used
                for chi-square difference testing in the regular way. MLM, MLR and WLSM
                chi-square difference testing is described on the Mplus website. MLMV, WLSMV,
                and ULSMV difference testing is done using the DIFFTEST option.

                RMSEA (Root Mean Square Error Of Approximation)

                Estimate 0.073
                90 Percent C.I. 0.054 0.093
                Probability RMSEA <= .05 0.026

                CFI/TLI

                CFI 0.761
                TLI 0.282

                Chi-Square Test of Model Fit for the Baseline Model

                Value 158.215
                Degrees of Freedom 6
                P-Value 0.0000

                WRMR (Weighted Root Mean Square Residual)

                Value 1.629



                MODEL RESULTS

                Two-Tailed
                Estimate S.E. Est./S.E. P-Value

                F1 BY
                D018 1.000 0.000 999.000 999.000
                D022 -0.659 0.151 -4.361 0.000
                D057 2.166 0.857 2.528 0.011
                D059 0.471 0.101 4.657 0.000

                Thresholds
                D018$1 -1.541 0.034 -45.485 0.000
                D022$1 1.108 0.028 39.590 0.000
                D057$1 -0.905 0.027 -33.909 0.000
                D057$2 -0.072 0.023 -3.147 0.002
                D057$3 0.957 0.027 35.199 0.000
                D059$1 -0.743 0.025 -30.121 0.000
                D059$2 0.386 0.023 16.851 0.000
                D059$3 1.440 0.033 43.505 0.000

                Variances
                F1 0.120 0.056 2.142 0.032


                R-SQUARE

                Observed Residual
                Variable Estimate Variance

                D018 0.120 0.880
                D022 0.052 0.948
                D057 0.564 0.436
                D059 0.027 0.973


                QUALITY OF NUMERICAL RESULTS

                Condition Number for the Information Matrix 0.159E-03
                (ratio of smallest to largest eigenvalue)


                SAMPLE STATISTICS FOR ESTIMATED FACTOR SCORES


                SAMPLE STATISTICS


                Means
                F1
                ________
                1 -0.001


                Covariances
                F1
                ________
                F1 0.051


                Correlations
                F1
                ________
                F1 1.000


                SAVEDATA INFORMATION

                Order and format of variables

                D018 F10.3
                D022 F10.3
                D057 F10.3
                D059 F10.3
                S007 I7
                F1 F10.3

                Save file
                c:\trash\temp2.dat

                Save file format
                4F10.3 I7 F10.3

                Save file record length 5000


                Beginning Time: 13:45:22
                Ending Time: 13:45:22
                Elapsed Time: 00:00:00



                MUTHEN & MUTHEN
                3463 Stoner Ave.
                Los Angeles, CA 90066

                Tel: (310) 391-9971
                Fax: (310) 391-8971
                Web: www.StatModel.com
                Support: [email protected]

                Copyright (c) 1998-2011 Muthen & Muthen

                . runmplus_load_savedata , out(c:/trash/trash.out) clear

                . list

                +------------------------------------------------------------+
                | d018 d022 d057 d059 s007 f1 |
                |------------------------------------------------------------|
                1. | 12345678 22345678 32345678 42345678 1 5345678 |
                +------------------------------------------------------------+

                Comment

                Working...
                X