Mplus is becoming a commonly used statistical modeling program that is used for structural equation modeling. It has many unique features (e.g., easy syntax, item-response analysis, latent-class analysis, indirect effects calculations, and random coefficients) that make it highly desirable for researchers.
One common problem that people have is getting their data in a format that can be used by Mplus. That is, many researchers use data management programs (such as SPSS or Excel) to enter data. Thus, one has to provide Mplus with a data file that was created in another program. The UCLA Statistical Consulting page has some great resources for this difficulty (they are also the authors of the highly entertaining podcast, Stattalk).
Is an Mplus .inp program case sensitive?
No. You can type commands in upper and lower case, e.g.
File is hsb2.dat ;
is the same as
FILE IS hsb2.dat ;
Can a command span over more than one line?
Yes, for example these two commands are identical.
Names = id female race ses schtyp prog read write math science socst;
Names = id female race ses schtyp prog
read write math science socst;
How do I indicate a comment?
A comment is indicated with !
The rest of the line after the ! is commented, for example
Names = id female race ses schtyp prog read write math; ! read the variables
or to comment out some
Names = id female race ses schtyp prog read write math; ! science socst;
Do I have to include the full path when pointing to a data file?
It depends. If you are reading a data file that is in the same folder (directory) as the input file, you do NOT need to include the full path when pointing to a raw data file. For example, if your data file is in c:\mydata\test.dat , and your input file is c:\mydata\myinput.inp, then you can read the raw data file like this.
File is test.dat ;
If your input file was in a different folder, then you would need to specify the full path, for example.
File is c:\mydata\test.dat ;
Does the order of variables matter on NAMES= ?
Yes, this represents the order of the variables in your raw data file, like on an input statement in other stat packages. So, in the example
Names = id female race ses;
It implies that the variables in the data file are id then female then race then ses .
Does the order of variables matter on USEVARIABLES?
No, this is simply a list of variables to be used for the analysis (kind of like a keep statement). By the way, this can be abbreviated to USEVAR . Here is an example.
Names = id female race ses;
usevar = female ses race;
And in this analysis only female, ses and race will be included.
Can commands be abbreviated?
Yes, as you saw in the example above,
Can Mplus handle user missing values (numeric missing values)?
Yes, with the Missing are command.
You can give all variables the same missing value, e.g. Missing are all (-999999999) ;
You can give different values for different variables, e.g. Missing are x1 x2 (-1) y1 y2 (-5) ;
You can even have multiple missing values for a variable, e.g. Missing are x1 x2 (-1 -2) y1 y2 (-5 -9) ;
Can Mplus handle periods (dots) as missing values?
Yes, you can specify Missing are .; and it will understand a . to be a missing value.
What about the is and are and = (equal sign). Are they all the same?
Yes, they are all the same. For example, the following statements all have the same effect.
Names are id female race ses
Names is id female race ses
Names = id female race ses