This tutorial provides the reader with a basic introduction to the software package blavaan (Merkle & Rosseel, 2016). blavaan is a free package that can be used within the R environment. The reader will be guided through the process of downloading blavaan and reading and running the R code to conduct a Bayesian regression analysis. Most of the written text consists of instructions. The exercises that are described in this document can also be found in the Regressionblavaan.r file, which includes all the commands to run.
Exercise 1 Open RStudio and open the .R file (Regressionblavaan.r) that’s included in the folder. Then follow the next steps:
a. Download and load the package ‘blavaan’.
b. Load data (regression.dat).
c. Give names to the variables in the dataset (“y”, “x1”, “x2”).
d. Specify the regression model.
Exercise 2 Running the regression model in blavaan:
a. Fit the Bayesian regression model in blavaan.
b. Obtain summary estimates of the parameters in the model.
c. Obtain plots of the parameters of the fitted model.
Exercise 3 Running the regression model again in blavaan, but now with specified priors:
a. Fit the new Bayesian regression model in blavaan.
b. Obtain summary estimates of the parameters in the model. Compare the results of model 1 and model 2, are there any differences?
c. Obtain the plots of the parameters again.