Mplus version 8 was used for these examples. All the files for this portion of this seminar can be downloaded here.
1.0 Descriptive statistics
To get basic descriptive statistics (means, variances, covariances and correlations) in Mplus, a Type = basic; statement must be included in the analysis command block. To view histograms or scatterplots of some of the variables, a plot command block should be included. These types of univariate and bivariate graphs are plot1 types of graphs.
The data set used in the following example is hsb.dat .
title: Exploring data data: file is hsb.dat; variable: names are id female race ses schtyp prog read write math science socst; usevariables are id female race ses schtyp prog read write math science socst; analysis: type = basic; plot: type is plot1;
Here is the output that Mplus generates.
INPUT READING TERMINATED NORMALLY Entering data example free format using hsb.dat SUMMARY OF ANALYSIS Number of groups 1 Number of observations 200 Number of dependent variables 11 Number of independent variables 0 Number of continuous latent variables 0 Observed dependent variables Continuous ID FEMALE RACE SES SCHTYP PROG READ WRITE MATH SCIENCE SOCST Estimator ML Information matrix OBSERVED Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Input data file(s) hsb.dat Input data format FREE RESULTS FOR BASIC ANALYSIS SAMPLE STATISTICS Means ID FEMALE RACE SES SCHTYP ________ ________ ________ ________ ________ 1 100.500 0.545 3.430 2.055 1.160 Means PROG READ WRITE MATH SCIENCE ________ ________ ________ ________ ________ 1 2.025 52.230 52.775 52.645 51.850 Means SOCST ________ 1 52.405 Covariances ID FEMALE RACE SES SCHTYP ________ ________ ________ ________ ________ ID 3333.250 FEMALE -2.508 0.248 RACE 44.825 0.001 1.075 SES 8.797 -0.045 0.146 0.522 SCHTYP 10.210 0.003 0.041 0.036 0.134 PROG -2.308 0.001 -0.036 0.009 -0.024 READ 87.755 -0.270 2.581 2.167 0.323 WRITE 101.907 1.208 2.157 1.417 0.441 MATH 118.282 -0.137 1.963 1.840 0.337 SCIENCE 183.260 -0.628 3.280 2.018 0.234 SOCST 113.332 0.279 2.111 2.568 0.380 Covariances PROG READ WRITE MATH SCIENCE ________ ________ ________ ________ ________ PROG 0.474 READ -0.951 104.597 WRITE -1.179 57.707 89.394 MATH -0.966 63.297 54.555 87.329 SCIENCE -1.291 63.650 53.266 58.212 97.537 SOCST -1.440 68.067 61.236 54.489 49.191 Covariances SOCST ________ SOCST 114.681 Correlations ID FEMALE RACE SES SCHTYP ________ ________ ________ ________ ________ ID 1.000 FEMALE -0.087 1.000 RACE 0.749 0.001 1.000 SES 0.211 -0.125 0.195 1.000 SCHTYP 0.482 0.015 0.108 0.137 1.000 PROG -0.058 0.004 -0.050 0.017 -0.095 READ 0.149 -0.053 0.243 0.293 0.086 WRITE 0.187 0.256 0.220 0.207 0.127 MATH 0.219 -0.029 0.203 0.272 0.098 SCIENCE 0.321 -0.128 0.320 0.283 0.065 SOCST 0.183 0.052 0.190 0.332 0.097 Correlations PROG READ WRITE MATH SCIENCE ________ ________ ________ ________ ________ PROG 1.000 READ -0.135 1.000 WRITE -0.181 0.597 1.000 MATH -0.150 0.662 0.617 1.000 SCIENCE -0.190 0.630 0.570 0.631 1.000 SOCST -0.195 0.621 0.605 0.544 0.465 Correlations SOCST ________ SOCST 1.000 UNIVARIATE SAMPLE STATISTICS UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS Variable/ Mean/ Skewness/ Minimum/ % with Percentiles Sample Size Variance Kurtosis Maximum Min/Max 20%/60% 40%/80% Median ID 100.500 0.000 1.000 0.50% 40.000 80.000 100.500 200.000 3333.250 -1.200 200.000 0.50% 120.000 160.000 FEMALE 0.545 -0.181 0.000 45.50% 0.000 0.000 1.000 200.000 0.248 -1.967 1.000 54.50% 1.000 1.000 RACE 3.430 -1.576 1.000 12.00% 3.000 4.000 4.000 200.000 1.075 0.888 4.000 72.50% 4.000 4.000 SES 2.055 -0.083 1.000 23.50% 1.000 2.000 2.000 200.000 0.522 -1.083 3.000 29.00% 2.000 3.000 SCHTYP 1.160 1.855 1.000 84.00% 1.000 1.000 1.000 200.000 0.134 1.440 2.000 16.00% 1.000 1.000 PROG 2.025 -0.032 1.000 22.50% 1.000 2.000 2.000 200.000 0.474 -0.892 3.000 25.00% 2.000 3.000 READ 52.230 0.195 28.000 0.50% 44.000 47.000 50.000 200.000 104.597 -0.637 76.000 1.00% 55.000 63.000 WRITE 52.775 -0.478 31.000 2.00% 44.000 52.000 54.000 200.000 89.394 -0.761 67.000 3.50% 57.000 62.000 MATH 52.645 0.284 33.000 0.50% 43.000 49.000 52.000 200.000 87.329 -0.663 75.000 1.00% 55.000 61.000 SCIENCE 51.850 -0.187 26.000 0.50% 42.000 50.000 53.000 200.000 97.537 -0.572 74.000 0.50% 55.000 61.000 SOCST 52.405 -0.379 26.000 1.50% 41.000 51.000 52.000 200.000 114.681 -0.541 71.000 4.00% 56.000 61.000 PLOT INFORMATION The following plots are available: Histograms (sample values) Scatterplots (sample values) DIAGRAM INFORMATION Mplus diagrams are currently not available for TYPE=BASIC. No diagram output was produced.
You can compare these summary statistics to those found in another software package or by hand to ensure that you have read the data into Mplus correctly. To view plots, you can select Plots -> View plots or press Alt-V to open the dialog box below.
From here, you can select Histograms and choose read from the drop down menu to get the plot below.
Alternatively, you can select Scatterplots and choose to look at math and write.
2.0 Descriptive statistics with missing data without listwise deletion
Next, we will look at a dataset with missing data. This time we will not include the id variable in the analyses. We will use the hsbmis.dat datafile and hsbmis.inp command file created by Stata in the previous section to demonstrate the descriptive statistics.
title: Exploratory analysis with missing data data: file is hsbmis.dat variable: names are id female race ses schtyp prog read write math science socst; missing are all (-9999); usevariables are female race ses schtyp prog read write math science socst; analysis: type = basic;
Here is the output generated by Mplus.
INPUT READING TERMINATED NORMALLY SUMMARY OF ANALYSIS Number of groups 1 Number of observations 200 Number of dependent variables 10 Number of independent variables 0 Number of continuous latent variables 0 Observed dependent variables Continuous FEMALE RACE SES SCHTYP PROG READ WRITE MATH SCIENCE SOCST Estimator ML Information matrix OBSERVED Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Maximum number of iterations for H1 2000 Convergence criterion for H1 0.100D-03 Input data file(s) hsbmis.dat Input data format FREE SUMMARY OF DATA Number of missing data patterns 7 SUMMARY OF MISSING DATA PATTERNS MISSING DATA PATTERNS (x = not missing) 1 2 3 4 5 6 7 FEMALE x x x x x x RACE x x x x x x x SES x x x x x x x SCHTYP x x x x x x x PROG x x x x x x x READ x x x x x x WRITE x x x x x x MATH x x x x x x SCIENCE x x x x x x SOCST x x x x x x MISSING DATA PATTERN FREQUENCIES Pattern Frequency Pattern Frequency Pattern Frequency 1 138 4 12 7 6 2 5 5 14 3 14 6 11 COVARIANCE COVERAGE OF DATA Minimum covariance coverage value 0.100 PROPORTION OF DATA PRESENT Covariance Coverage FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ FEMALE 0.970 RACE 0.970 1.000 SES 0.970 1.000 1.000 SCHTYP 0.970 1.000 1.000 1.000 PROG 0.970 1.000 1.000 1.000 1.000 READ 0.915 0.945 0.945 0.945 0.945 WRITE 0.900 0.930 0.930 0.930 0.930 MATH 0.910 0.940 0.940 0.940 0.940 SCIENCE 0.900 0.930 0.930 0.930 0.930 SOCST 0.945 0.975 0.975 0.975 0.975 Covariance Coverage READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ READ 0.945 WRITE 0.875 0.930 MATH 0.885 0.870 0.940 SCIENCE 0.875 0.860 0.870 0.930 SOCST 0.920 0.905 0.915 0.905 0.975 RESULTS FOR BASIC ANALYSIS ESTIMATED SAMPLE STATISTICS Means FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ 1 0.546 3.430 2.055 1.160 2.025 Means READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ 1 52.326 52.561 52.768 51.852 52.354 Covariances FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ FEMALE 0.247 RACE 0.015 1.075 SES -0.041 0.146 0.522 SCHTYP 0.003 0.041 0.036 0.134 PROG 0.008 -0.036 0.009 -0.024 0.474 READ -0.259 2.626 2.281 0.364 -0.959 WRITE 1.193 2.053 1.388 0.475 -1.202 MATH -0.253 2.076 1.658 0.237 -1.117 SCIENCE -0.596 3.066 1.859 0.295 -1.461 SOCST 0.256 2.042 2.548 0.388 -1.435 Covariances READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ READ 104.556 WRITE 56.806 88.288 MATH 61.093 53.278 84.485 SCIENCE 64.333 54.832 58.322 94.201 SOCST 67.681 60.178 50.695 50.635 115.474 Correlations FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ FEMALE 1.000 RACE 0.029 1.000 SES -0.113 0.195 1.000 SCHTYP 0.014 0.108 0.137 1.000 PROG 0.024 -0.050 0.017 -0.095 1.000 READ -0.051 0.248 0.309 0.097 -0.136 WRITE 0.255 0.211 0.204 0.138 -0.186 MATH -0.055 0.218 0.250 0.070 -0.176 SCIENCE -0.123 0.305 0.265 0.083 -0.219 SOCST 0.048 0.183 0.328 0.099 -0.194 Correlations READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ READ 1.000 WRITE 0.591 1.000 MATH 0.650 0.617 1.000 SCIENCE 0.648 0.601 0.654 1.000 SOCST 0.616 0.596 0.513 0.485 1.000 MAXIMUM LOG-LIKELIHOOD VALUE FOR THE UNRESTRICTED (H1) MODEL IS -4148.435 UNIVARIATE SAMPLE STATISTICS UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS Variable/ Mean/ Skewness/ Minimum/ % with Percentiles Sample Size Variance Kurtosis Maximum Min/Max 20%/60% 40%/80% Median FEMALE 0.546 -0.186 0.000 45.36% 0.000 0.000 1.000 194.000 0.248 -1.965 1.000 54.64% 1.000 1.000 RACE 3.430 -1.576 1.000 12.00% 3.000 4.000 4.000 200.000 1.075 0.888 4.000 72.50% 4.000 4.000 SES 2.055 -0.083 1.000 23.50% 1.000 2.000 2.000 200.000 0.522 -1.083 3.000 29.00% 2.000 3.000 SCHTYP 1.160 1.855 1.000 84.00% 1.000 1.000 1.000 200.000 0.134 1.440 2.000 16.00% 1.000 1.000 PROG 2.025 -0.032 1.000 22.50% 1.000 2.000 2.000 200.000 0.474 -0.892 3.000 25.00% 2.000 3.000 READ 52.397 0.140 28.000 0.53% 44.000 48.000 52.000 189.000 105.160 -0.668 76.000 1.06% 55.000 63.000 WRITE 52.731 -0.482 31.000 2.15% 44.000 52.000 54.000 186.000 88.777 -0.766 67.000 3.23% 57.000 62.000 MATH 52.532 0.314 33.000 0.53% 43.000 49.000 52.000 188.000 84.334 -0.575 75.000 1.06% 55.000 61.000 SCIENCE 51.763 -0.231 26.000 0.54% 42.000 50.000 53.000 186.000 93.654 -0.527 74.000 0.54% 55.000 61.000 SOCST 52.441 -0.378 26.000 1.54% 41.000 51.000 52.000 195.000 115.518 -0.541 71.000 4.10% 56.000 61.000 DIAGRAM INFORMATION Mplus diagrams are currently not available for TYPE=BASIC. No diagram output was produced.
In the first section, “SUMMARY OF ANALYSIS”, we see that the “Number of Observations” used is 200, the total number of observations in the data set. Additionally, we see that the “Estimator” used is “ML”, which is short for Maximum Likelihood. By default Mplus uses the maximum likelihood estimation, and it uses all the available values instead of doing deleting any observations with missing (listwise deletion). Because of this, the descriptive statistics from Mplus do not match with the output from a standard statistics software package, such as SPSS, Stata, SAS, or R, which use listwise deletion when missing data are present.
In the section of the Mplus output titled “SUMMARY OF MISSING DATA PATTERNS”, we can see which combinations of variables are missing for how many observations in our data. From this section of output, we can see that we have 138 complete observations and no more than one missing variable in any of our other observations. There is a portion of the output labeled “COVARIANCE COVERAGE.” This matrix gives the proportion of values present for each variable individually (on the diagonal) and pairwise combinations of variables (below the diagonal).
3.0 Descriptive statistics with missing data with listwise deletion
For the purpose of comparing the results of descriptive statistics run in SAS, Stata or SPSS against the results obtained from Mplus to ensure that your data have been read into Mplus correctly, you can request that Mplus does listwise deletion as well. Here is the syntax. Notice in “SUMMARY OF ANALYSIS” that only 138 observations are used with listwise deletion.l
title: Exploring data with listwise deletion of missing data data: file is hsbmis.dat; listwise = on; variable: names are id female race ses schtyp prog read write math science socst; missing are all (-9999); usevariables are female race ses schtyp prog read write math science socst; analysis: type = basic;
INPUT READING TERMINATED NORMALLY SUMMARY OF ANALYSIS Number of groups 1 Number of observations 138 Number of dependent variables 10 Number of independent variables 0 Number of continuous latent variables 0 Observed dependent variables Continuous FEMALE RACE SES SCHTYP PROG READ WRITE MATH SCIENCE SOCST Estimator ML Information matrix OBSERVED Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Input data file(s) hsbmis.dat Input data format FREE RESULTS FOR BASIC ANALYSIS SAMPLE STATISTICS Means FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ 1 0.565 3.442 2.058 1.167 2.043 Means READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ 1 52.442 52.630 52.913 52.065 52.696 Covariances FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ FEMALE 0.246 RACE 0.018 1.102 SES -0.026 0.105 0.533 SCHTYP -0.007 0.057 0.019 0.139 PROG 0.004 -0.063 -0.024 -0.022 0.491 READ -0.054 2.739 1.634 0.151 -1.360 WRITE 1.165 1.656 1.275 0.417 -1.332 MATH -0.139 2.017 1.578 0.275 -1.228 SCIENCE -0.334 3.167 1.648 0.351 -1.764 SOCST 0.397 2.301 2.373 0.486 -1.951 Covariances READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ READ 99.305 WRITE 59.555 90.653 MATH 57.495 53.250 79.819 SCIENCE 63.102 56.379 56.622 95.742 SOCST 73.693 64.438 54.887 56.665 122.429 Correlations FEMALE RACE SES SCHTYP PROG ________ ________ ________ ________ ________ FEMALE 1.000 RACE 0.035 1.000 SES -0.071 0.137 1.000 SCHTYP -0.039 0.145 0.071 1.000 PROG 0.013 -0.085 -0.047 -0.083 1.000 READ -0.011 0.262 0.225 0.041 -0.195 WRITE 0.247 0.166 0.183 0.117 -0.200 MATH -0.031 0.215 0.242 0.083 -0.196 SCIENCE -0.069 0.308 0.231 0.096 -0.257 SOCST 0.072 0.198 0.294 0.118 -0.252 Correlations READ WRITE MATH SCIENCE SOCST ________ ________ ________ ________ ________ READ 1.000 WRITE 0.628 1.000 MATH 0.646 0.626 1.000 SCIENCE 0.647 0.605 0.648 1.000 SOCST 0.668 0.612 0.555 0.523 1.000 UNIVARIATE SAMPLE STATISTICS UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS Variable/ Mean/ Skewness/ Minimum/ % with Percentiles Sample Size Variance Kurtosis Maximum Min/Max 20%/60% 40%/80% Median FEMALE 0.565 -0.263 0.000 43.48% 0.000 0.000 1.000 138.000 0.246 -1.931 1.000 56.52% 1.000 1.000 RACE 3.442 -1.595 1.000 12.32% 3.000 4.000 4.000 138.000 1.102 0.878 4.000 74.64% 4.000 4.000 SES 2.058 -0.090 1.000 23.91% 1.000 2.000 2.000 138.000 0.533 -1.121 3.000 29.71% 2.000 3.000 SCHTYP 1.167 1.789 1.000 83.33% 1.000 1.000 1.000 138.000 0.139 1.200 2.000 16.67% 1.000 1.000 PROG 2.043 -0.060 1.000 22.46% 1.000 2.000 2.000 138.000 0.491 -0.963 3.000 26.81% 2.000 3.000 READ 52.442 0.144 31.000 0.72% 44.000 50.000 52.000 138.000 99.305 -0.688 76.000 0.72% 55.000 63.000 WRITE 52.630 -0.465 31.000 2.17% 44.000 52.000 54.000 138.000 90.653 -0.781 67.000 4.35% 57.000 62.000 MATH 52.913 0.212 33.000 0.72% 45.000 50.000 53.000 138.000 79.819 -0.518 75.000 1.45% 56.000 61.000 SCIENCE 52.065 -0.271 26.000 0.72% 42.000 50.000 53.000 138.000 95.742 -0.459 74.000 0.72% 55.000 61.000 SOCST 52.696 -0.441 26.000 2.17% 44.000 51.000 54.000 138.000 122.429 -0.451 71.000 5.07% 56.000 61.000 DIAGRAM INFORMATION Mplus diagrams are currently not available for TYPE=BASIC. No diagram output was produced.