Creating mplus data file
The prepareMplusData function converts an R data. The corresponding Mplus syntax, including the data file definition and variable names, is printed to the console or optionally to an input file. The path and filename for the tab-delimited data file for use with Mplus. Logical value whether the Mplus syntax should be written to the console or to an input file.
If TRUE , the file name will be the same as filename with the extension changed to. Alternately, this can be a character string giving the file name to write the Mplus syntax to. A character vector specifying the variable names within df to be output to filename or a numeric vector of the column indices to be output or a logical vector corresponding to the same. Mplus requires data to be read in from a text file without variable names, with numeric values only, and with missing data coded as a single numeric value, such as A common workflow for preparing data to analyze in Mplus is to perform the variable cleaning in SPSS and then save the data as a text file.
These data do not include any missing values, but if they did we could easily convert all variables to have missing coded as In the new dialog box, select System-missing under Old Value. Enter in the Value field under New Value.
Click Add so that you see the following:. Next, uncheck the box next to Write variable names to file. Mplus also has extensive Monte Carlo simulation capabilities to generate data from statistical analyses and to perform power analyses.
In this seminar, we will learn some basic Mplus syntax which will empower you to use Mplus on your own. Mplus creates an output file for each input file that is run. This opens by default after the analysis has been run, and it has the same name as the input file but has an.
Missing values cannot be represented by blank spaces in free format. Most data files will be in this format. The example below contains the first 20 lines from a file called hsb. Here you can see the variables are separated by commas, and the variable names are not on the first line.
The variables in the file are id , female , race , ses , schtyp , prog , read , write , math , science and socst. A second option for formatting data files is fixed format, where variables occupy fixed positions in the data file e. Files formatted in this way were more commonly encountered in the past.
The file fixed. The codebook for the data is given below. The Mplus input file contains all of the commands to read the data file properly, run the statistical analysis, and to produce any graphs or additional output. Here are the commonly used commands required sections are bolded :. Place a colon : after the name of the command in the input file so Mplus will recognize it as a command.
After the command and colon, we specify code and options for that command. Each command option specification is separated by a semicolon ;. Command and option names can be shortened to their first four letters.
The DATA command is required and contains the location of the data file and information about how it is formatted. By default, Mplus expects a free-formatted data file. If one, a basic model is run. If greater than one, the model is bootstrapped with run replications as well as the basic model.
A logical whether warnings about variable length should be left, the default, or removed from the output file. This covers situations where Mplus is not in the system's path, or where one wants to test different versions of the Mplus program.
This is passed on to prepareMplusData. Note that previously, mplusModeler always re wrote the data to disk. However, now the default is to write the data to disk only if it is missing i. See details for further information. A logical whether or not to add a hash of the raw data to the data file name.
Note that this behavior is a change from previous versions and differs from prepareMplusData which maintains the old behavior by default of FALSE.
0コメント