Data Files
Mplus can read data (that is, raw data, with cases in rows and variables in colums), but it may also use covariance matrices and other stuff. Currently, this section is about data only.
Mplus can read data in ASCII code. The data consist of numbers, with decimals separated by periods.
The data can be organized in two ways: FREE or FIXED FORMAT.
Data in free format
In free format (which is the default), values (that is, columns containing the values of variables) are delimited, or separated, by commas, tabs or spaces. In my view, commas are preferable because you can easily discern whether or not your file is alright.
Creating free format data for Mplus with other software
How to create a free format file from SPSS®
The example shows how to create a "comma separated values" file:
SAVE TRANSLATE OUTFILE='C:\directory\subdirectory\filename.csv'
/TYPE=csv
/TEXTOPTION DECIMALS = dot DELIMITER=","
/MAP
/REPLACE
/Keep=id var1 var2 var3a var3b.
Don't forget to think about missing values. System missing values are written as blanks, which will be interpreted correctly by Mplus only if data are in fixed format.
How to create a free format file from Stata™
I have not tried this, but it sounds reasonable: There is a specific command, which users most likely will have to download first (using findit
), and which creates both a csv data set, filename.dat
, apparently in free format, and an mplus input file, filename.inp
, that defines the data for Mplus. Missing values are set to -9999 by default. It goes like this:
stata2mplus using "C:\mydirectory\mysubdirectory\filename", replace
You may also insert a list of variables (before "using"), and there are options for definition of missing values.
Thanks to Alan Acock who points this out in his PDF introduction to Mplus (see my Mplus links).
How to create a free format file from Microsoft Excel™
Save the file using "save as", and select "csv" (or "text, tab delimited", should you so desire) as file type. You will be asked to confirm that you wish to save only the first worksheet, and also warned that some formatting elements will be lost. Of course, this will be exactly what you want.
Note that depending on your system, the columns in a "comma separated value" file may actually not be separated by commas, but rather by other characters. To change this, you have to use Windows' control panel (in German: Systemsteuerung) and look for country and language specifications. Here you should find a panel in which you can indicate which character to use as a delimiter.
It may even be the case that Excel uses a decimal sign other than the period. You may likewise change this via the control panel.
Data in fixed format
To follow (older people will remember good old Fortran formats; this is what you need here!).
© W. Ludwig-Mayerhofer, Mplus Guide | Last update: 24 Feb 2010