Basic Exploratory Factor Analysis (EFA) Example

Table of Contents

1 Title Command

This is used to name your Mplus input file, this can help you keep track of multiple input files.

TITLE:
Example 1 - Exploratory Factor Analysis

2 Data Command

This is where the data file is specified. If the data file is in the same folder as your .inp file, the user simply needs to specify the name of the file (e.g., "FILE IS job_placement.csv"). If the data file is in different folder, the user needs to specify the path to the datafile here. Below the "../../data/job_placement.csv" command is telling Mplus to start in the folder where the .inp file is saved, then go back two levels ("../../"), go into the "data" folder ("data/"), and then find the data file ("job_placement.csv"). Note that the FILE is line ends with a semicolon, this is required at the end of each line in all commands except the TITLE command. Remember, the datafile can only be a matrix of numerical values, no variable names are allowed in the imported data.

DATA:
FILE IS "../../data/job_placement.csv";

3 Variable Command

Once the data file is read in, information about the dataset must be provided. This is done in the VARIABLE command. There are no variable names in the data file, so these must be entered here by the user. Under "NAMES ARE", the user must list the variable columns in the data file from left to right. It is extremely important that the number of variables and the order of the variables are entered correctly.

VARIABLE:
NAMES ARE
id wjcalc wjspl wratspl wratcalc waiscalc waisspl
edlevel newschl suspend expelled haveld female age;

After the variables in the data file are named, the user can then specify which variables they want to include in the model under "USEVARIABLES ARE". In this example the user wants to run an EFA with six indicator variables, so only those six variables are entered into the "USEVARIABLES ARE" command.

USEVARIABLES ARE
wjcalc wjspl wratspl wratcalc waiscalc waisspl;

Lastly, there are missing values in the data file that have been replaced with "99999". The "MISSING ARE all (99999);" command tells Mplus that all values equal to 99999 are not truly equal to 99999 and that they should be treated as missing.

MISSING ARE all(99999);

4 Analysis Command

The ANALYSIS command can be used to specify a variety of analyses. Here the line "TYPE = EFA 1 2;" is telling Mplus to do an EFA and to fit models with 1 and 2 factors, plus all whole numbers in between (there are none in this case). If we were to enter "TYPE = EFA 1 3;", then Mplus would test models with 1, 2, and 3 latent factors.

ANALYSIS:
TYPE = EFA 1 2;

Date: 2016-09-12T14:37-0500

Author: Benjamin Arthur Kite

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0