February 28, 2024
Mplus at a Glance
General Description
Mplus Programs
Version History
System Requirements
Mplus Demo Version
Mplus Web Talks
Short Courses
Short Course Videos
and Handouts
Web Training
Mplus YouTube Channel
Mplus User's Guide
Mplus Diagrammer
Technical Appendices
Mplus Web Notes
User's Guide Examples
Mplus Book
Mplus Book Examples
Mplus Book Errata
Mplus Examples
Special Mplus Topics
Bayesian SEM (BSEM)
Complex Survey Data
DSEM MultiLevel Time Series Analysis
Exploratory SEM (ESEM)
Measurement Invariance
and Alignment
Mediation Analysis
Missing Data
Mixture Modeling
Multilevel Modeling
Randomized Trials
Structural Equation Modeling
Survival Analysis
Using Mplus via R
Mplus plotting using R
Chi-Square Difference
Test for MLM and MLR
Power Calculation
Monte Carlo Utility
Mplus Website Updates
Mplus Privacy Policy
VPAT/508 Compliance

Example using the RUNALL utilty

Using the cont3.inp example in the Continuous set of examples on this website, we have generated 10 data files for the model and wish to run cont3_ex.inp using all 10 data files. The results for all 10 runs should be saved into a file so that it can be processed as data.

Steps to use RUNALL:

  1. Place all the data files to be used for the run in one directory.
    The data files are located in the C:\Projects\Testdata directory. Set DATA_DIR in runstart.bat to C:\Projects\Testdata.

  2. Place the input file in a working directory.
    The working directory is C:\Testdir. Set WORKING_DIR in runstart.bat to C:\Testdir.

    Here is the input file for this run:

    TITLE:  cont3_ex (example to demonstrate the use of RUNALL)
        Classic structural equation model with multiple indicators
        used in a study of the stability of alienation.
        Wheaton, B., Muthen, B., Alwin, D., & Summers, G. (1977).
        Assessing the reliability and stability in panel models.
        In D.R. Heise (ed), Sociological Methodology 1977.
        San Francisco:  Jossey-Bass.
        FILE IS cont3_data.dat;
        NAMES ARE anomia67 power67 anomia71 power71 educ sei;
    !   first the measurement model part using the keyword BY:
        ses BY educ sei;
        alien67 BY anomia67 power67;
        alien71 BY anomia71 power71;
    !   next the structural model part using the keyword ON:
        alien71 ON alien67 ses;
        alien67 ON ses;
    !   and then adding correlated residuals over time using
    !   the keyword WITH:
        anomia67 WITH anomia71;
        power67 WITH power71;
        sampstat tech1;
        FILE (RESULTS) IS results.sav;

    Important parts from the input file

       FILE IS cont3_data.dat;
    The data file specified in the input is cont3_data.dat. The filename given here is only a generic name. It does not include a direct path. No data file needs to exist with this name when using RUNALL. As the utility loops through all the files in your data directory, it will copy each file to the working directory and rename it cont3_data.dat. Set COMMON_DATA in runstart.bat to cont3_data.dat.

    Also, it is assumed here that all data files used for this input are in free format. For any run, all data files in the set to be used for a particular input must have the same data format.

       FILE (RESULTS) IS results.sav;
    The RESULTS file saved for each run is results.sav. Set COMMON_RESULTS in runstart.bat to results.sav.
        sampstat tech1;

    TECH1 output option has been requested so that we can see the order of the parameter specification. SAVEDATA RESULTS will save the parameter estimates and standard errors of the parameter estimates in this order.

  3. Change the necessary settings in runstart.bat to customize the run.

    Following are the settings in runstart.bat for this run:

    REM **************************************************************
    REM * WORKING_DIR                                                *
    REM *    The working directory.  This is the directory in which  *
    REM *    you should place the input and use the RUNALL utility.  *
    REM **************************************************************
    REM **************************************************************
    REM * DATA_DIR                                                   *
    REM *    The data directory.  This is the directory which        *
    REM *    contains the data files.  It is recommended that this   *
    REM *    directory be different from the working directory.      *
    REM **************************************************************
    REM **************************************************************
    REM * FILES                                                      *
    REM *    Wildcard expression describing the data files you want  *
    REM *    to use in the data directory.                           *
    REM **************************************************************
    REM **************************************************************
    REM * INPUT_FILE                                                 *
    REM *    Name of the input file.                                 *
    REM **************************************************************
    SET INPUT_FILE=cont3_ex.INP
    REM **************************************************************
    REM * COMMON_DATA                                                *
    REM *    Name of the data filed specified in the input file.     *
    REM **************************************************************
    SET COMMON_DATA=cont3_data.DAT
    REM **************************************************************
    REM * COMMON_RESULTS                                             *
    REM *    Name of the file specified for the SAVEDATA RESULTS     *
    REM *    option.                                                 *
    REM **************************************************************
    REM **************************************************************
    REM * ALL_RESULTS                                                *
    REM *    Name of the file to which results from each run should  *
    REM *    be saved.                                               *
    REM **************************************************************
    SET ALL_RESULTS=cont3_results.SAV
    REM **************************************************************
    REM * TEMP_FILE                                                  *
    REM *    Name of a temporary file for use by the RUNALL utility. *
    REM **************************************************************
    SET TEMP_FILE=runall.tmp
    REM **************************************************************
    REM * ERROR_LOG                                                  *
    REM *    Name of the error log file.  This file contains the     *
    REM *    names of data files which caused the model to not       *
    REM *    terminate normally.                                     *
    REM **************************************************************
    SET ERROR_LOG=error.log
    REM **************************************************************
    REM * COMPLETED_LOG                                              *
    REM *    Name of the log file for completed runs.  This file     *
    REM *    contains the names of data files for which the model    *
    REM *    terminated successfully.  The order of the data files   *
    REM *    listed in the COMPLETED_LOG file corresponds to the     *
    REM *    order of results saved in the ALL_RESULTS file.         *
    REM **************************************************************
    SET COMPLETED_LOG=completed.log
  4. Type RUNALL at the MS-DOS prompt.

  5. When the run completes, look at the following files for information:

    • The RESULTS SAVING INFORMATION at the end of the output file gives the order data have been saved.
        Order of data
          Parameter estimates
           (saved in order shown in Technical 1 output)
          Standard errors
           (saved in order shown in Technical 1 output)
          Chi-square : Value
          Chi-square : Degrees of Freedom
          Chi-square : P-Value
          H0 Loglikelihood
          H1 Loglikelihood
          Information Criteria : Number of Free Parameters
          Information Criteria : Akaike (AIC)
          Information Criteria : Bayesian (BIC)
          Information Criteria : Sample-Size Adjusted BIC
          RMSEA : Estimate
          RMSEA : Low CI
          RMSEA : High CI
          RMSEA : Probability
        Save file
        Save file format           Free
    • The file error.log contains the names of data files for which results were not saved. Because this file was not produced for this example, all data files produced successful runs.

    • The file cont3_results.sav contains the results for all successful runs. This file can be used as a data file where each observation is a successful run. The variables in this new data file are the results that are saved (parameter1, parameter2, ..., se1, se2, ..., chi-square, logL, etc.). For our example, we used 10 data files with all 10 producing successful model termination. This means that there are 10 observations in the cont3_results.sav data file.

    • The file completed.log contains the names of data files for which results were saved. The order of the data files corresponds to the order the results were saved. For example, suppose that the first file listed in completed.log is data4.dat. Then the first set of results (or you can also think of it as the first observation) in cont3_results.sav was produced using the data file data4.dat. Similarly, if the second data file listed is data9.dat, then the second set of results (second observation) was produced using the data file data9.dat.