Exercise - First Bayesian Inference
Developed by Sonja Winter (version 1), Lion Behrens (version 2) and Rens van de Schoot
This Shiny App is designed to ease its users first contact with Bayesian statistical inference. By “pointing and clicking”, the user can analyze the IQ-example as has been used in the easy-to-go introduction to Bayesian inference of van de Schoot et al. (2013).
They are continuously improving the tutorials so let them know if you discover mistakes, or if you have additional resources they can refer to. The source code is available via Github. If you want to be the first to be informed about updates, follow Rens on X.
Exercises
The exercise aims to play around with data and priors to see how these influence the posterior using the Shiny App First Bayesian Inference.
a)
Pretend you know nothing about IQ except that it cannot be smaller than 40 and that values larger than 180 are impossible. Which prior will you choose?
b)
Generate data for 22 individuals and run the Bayesian model (default option). Write down the prior and data specifications, and download the plot.
c)
Change the prior to a distribution which would make more sense for IQ: we know it cannot be smaller than 40 or larger than 180, AND it is expected to be normally distributed around 100 (=prior mean). However, how sure are you about these values (=prior variance)? Try values for the prior variance of 10 and 1. Write down the prior and data specifications, run the two models, and download the plot. How would you describe the relationship between your level of uncertainty and the posterior variance?
d)
Now, re-run the model with a larger sample size (n=100). Write down the prior and data specifications, run the model, and download the plot. How are the current results different from the results under ‘c’?
e)
Repeat steps ‘c’ and ‘d’ but now for a different prior mean using a sample size of 22 (assuming your prior knowledge conflicts with the data, e.g., IQ_mean=90). Write down the prior and data specifications, run the model, and download the plot. How did the new results differ when compared to the results with a ‘correct’ prior mean?
f)
What happens if your prior mean is exceptionally far away from the data, for example, IQ_mean=70 (using n=22). Write down the prior and data specifications, run the model, and download the plot. How did the new results differ when compared to the results with a ‘correct’ prior mean? Note that this situation is extreme, and in reality, the prior is much closer to the data.
References
Winter, S. D., Behrens, L., & van de Schoot, R. (2018, June 27). First Bayesian Inference Shiny App [version 2.0]. Retrieved from osf.io/vg6bw
van de Schoot, R., Kaplan, D., Denissen, J., Asendorpf, J. B., Neyer, F. J. and van Aken, M. A.G. (2014), A Gentle Introduction to Bayesian Analysis: Applications to Developmental Research. Child Dev, 85: 842–860. doi:10.1111/cdev.12169