How to Work with Mplus

Mplus works in very old-fashioned, classical ways: You enter some commands into a file (window), the commands are submitted to the programme, and the output is displayed in another file (window).

Is it all old-fashioned DOS?

No. Mplus comes with an editor specifically designed to run Mplus. The editor even offers the possibility to create the commands for input via a menu, at least for some common types of analysis. Whichever way you have chosen, once your input file is complete, you can submit it by clicking on the RUN button.

Mplus Screenshot Input



Writing Mplus commands (or input files) is not complicated. I will say a few words in the next section. Here is just one thing you should know about the input file: When you save it, it will automatically save with the extension ".inp". Of course, you may give it a name that later may help you to relate it to a specific project or analysis.

Basics of command input

For most analyses, a few commands will suffice. Of course, commands typically contain subcommands and a couple of specifications, but as long as what you plan to do is not overly complicated, working with Mplus commands is quite smooth (much smoother than, for instance, understanding the statistics behind it all).

Often, a command file with four commands will do:

TITLE:
Put your title here (may extend over several lines)

DATA:


Filename, such as "c:\mymplus\project.dta";

VARIABLE:


List of variables, such as var1-var17, plus possibly
some additional information as to measurement level
or missing values;

MODEL:


Indicate here which variable(s) influence which other variable(s)
in which way;

As you can see, command keywords are followed by a colon. The commands and possible subcommands, of which you will find many examples later, end with a semicolon (in the case of title, where no subcommand is expected, no semicolon is needed). It does not matter whether you use uppercase or lowercase letters, but writing the (sub)commands in uppercase letters may render your file more legible.

Important notice: The records in the input setup must be no longer than 80 columns. Nearly always, commands will be longer than that. As you can see in the example, lines can be wrapped around and the text may indeed stretch over as many lines as you like. Just don't forget the semicolon at the end.

The new lines after the command keywords and the empty lines separating one part of the file from the next are not required. But the layout I have chosen above is supposed to render your input file more legible.

Comments

Everything following an exclamation mark (!) will be treated as a comment. The exclamation mark may be put on the beginning of a line, thus annihilating, as it were, the entire line, but it may also follow a command or a part of a command somewhere along the line. You can find a few examples in the screenshot above. You will notice that comments are automatically displayed in green.

© W. Ludwig-Mayerhofer, Mplus Guide | Last update: 24 Feb 2010