First Bayesian Inference: MPLUS

Developed by Naomi Schalken and Rens van de Schoot

Exercise 1 - Simple regression analysis in Mplus

a. In the data file Regression.txt there are three variables (y1, x1, x2). For this exercise you will analyze a simple regression model where Y1 is predicted by X1 and X2. Let’s say that Y1 measures depression and X1 measures age and X2 measures anxiety. The research question is whether depression can be predicted by age and anxiety level. First analyze this regression in SPSS/SAS/STATA/EXCEL. Note that you have to interpret the results using the correct interpretation according to the definition of Frequentist or Bayesian probability.

  1. Question: What are the results in terms of statistical terms (regression coefficients, confidence intervals and significance levels)?
  1. Question: What is the answer to the research question?

 

b. Analyze the same regression model using Mplus (see the syntax file Regression.inp) with the default estimator. Note: you have to add the regression model yourself.

 

c. Change the default estimator into a Bayesian estimator by adding the following syntax:

ANALYSIS: ESTIMATOR = BAYES;

 

Delete sampstat from output line; this option is not available for Bayesian analysis. To obtain the plots in Mplus, specify at the end of the syntax:

PLOT: TYPE=PLOT2;

 

In the output you will see the following: PLOT INFORMATION - The following plots are available. To obtain the plots, go to Menu -> Plot -> View Plots and select the plots you would like to see. Do not worry about any other settings (yet!), just ‘naively’ change the estimator.

  1. Question: What are the results for the Bayesian analysis?
  1. Question: Are there any differences with the ML output? (You should answer ‘yes’ to this question, since the values, e.g. regression coefficients, confidence intervals, etc, have different interpretations). Please describe the differences

 

 

Exercise 2 - Sensitivity Analysis in Mplus

In the data file data_IQ.txt there is information about the IQ scores of 20 children. Use the Mplus syntax file IQ_1.inp. Run the model using maximum likelihood estimation (ML) and fill in the first row of this table. You find it in the document table.doxc or you can directly download it by clicking on the table!

 

Rerun the model using the file IQ_2.INP using

ANALYSIS: ESTIMATOR is BAYES;

 

Also request the TECH8 output (be sure you requested for the Higher Posterior Density to obtain a-symmetric credibility intervals:

CINTERVAL(HPD)

 

Fill in the second row of the table. To get output for the default prior, do not ‘read’ the lines specifying priors by putting a ‘!’ in front of them.

Question: Are there any differences compared to the ML estimates? Which prior was used for the mean score, see the Technical 1 Output? Is this prior realistic for the mean IQ score?

 

Specify an alternative prior using the syntax in IQ_2.inp. Replace MEAN with a plausible value for IQ. You should indicate how certain you are about this mean by filling in a variance for VARIANCE. First use a large variance, for example, 100. Run the model and fill in the table. Run the model again, but now specify a medium variance or a very small variance. Now, mis-specify the prior by using an unrealistic mean and run the analysis again. Then run two models where this unrealistic mean is combined with either a large or a small variance.

Question: Compare the results of the posterior means and C.I’s, what do you conclude?

 

Now compare the results of the posterior means for IQ score more formally, by computing the bias of the different informative priors with regard to the posterior mean with the default Bayes prior. You can use the following formula:

 

Task: Record your answers in the final column of the table above.

Question: What is your personal conclusion about the influence of priors on the outcomes of the model?

 

 

Exercise 3 - Regression with 10 predictors

In the dataset question3.txt there is information about secondary school students in a Portuguese language course. The dataset consists of several social, gender and study-related variables that can be used as predictors of the final grade in Portuguese (G3). The variables in the model:

 

  • G1 - First period grade (0-20)
  • G2 - Second period grade (0-20)
  • G3 - Final grade (0-20)
  • Absences - Number of school absences (0-93)
  • Health - Current health status (from 1-5)
  • Walc - Weekend alcohol consumption (from 1-5)
  • Dalc - Workday alcohol consumption (from 1-5)
  • Goout - Going out with friends (from 1-5)
  • Freetime - Free time after school (from 1-5)
  • Sex - Student’s sex (0 = Male, 1 = Female)
  • Studytime - Weekly study time (from 1-4)

 

Task: Open the Mplus input file ‘Question3’ and run the model.

Question: What can be concluded about the predictors? Give some conclusions about the model and a substantive interpretation of the significant predictors.

 

Other software exercises you might be interested in

MPLUS

How to get started

How to avoid and when to worry about the misuse of Bayesian Statistics

------------------------------------------

SPSS

How to get started

------------------------------------------

Lavaan

How to get started

------------------------------------------

Blavaan

How to get started

First Bayesian Inference

How to avoid and when to worry about the misuse of Bayesian Statistics

------------------------------------------

RJAGS

How to get started

First Bayesian Inference

How to avoid and when to worry about the misuse of Bayesian Statistics

------------------------------------------

JASP

How to get started