# Bayesian Estimation of Decision Models

New section added in September 2024:

- meta-analysis

- two stage regression using measurement error models

- multiple hierarchies over more than 2 levels

â€‹

Bayesian analysis has many practical advantages that that make it a formidable tool for the estimation of (nonlinear) models of decision-making. Here, I provide a tutorial for Bayesian estimation of such models using R and Stan (though the Stan code could easily be used based on other platforms such as Python, or indeed directly launched from the command prompt). Feel free to use these notes as you see fit. Below, I provide some indications about the different sections that are available. Keep checking back, though, as this is work in progress.

PLEASE NOTE: This initial version will inevitably contain some (hopefully small) mistakes, inconsistencies between section, and passages that are difficult to understand. If you do find such errors or have questions, do not hesitate to contact me.

â€‹

If you use code from these notes in your work, or if you build upon the exposition in this tutorial, please cite the notes as follows:

Vieider, Ferdinand M. (2024). Bayesian Estimation of Decision Models. URL: https://fvieider.quarto.pub/bstats/

â€‹

The companion data and Stan code for the tutorial are available on OSF at https://osf.io/ra2t4/

## Overview

Below, I provide a brief overview of the sections that are currently available. I also provide a brief description, that hopefully will allow you to assess where to start.

### Introduction

The introduction contains a concise discussion of the practical merits of Bayesian statistics, particularly when used to estimate decision-making models. You best start here if you are curious about Bayesian statistics, but you do not know its practical advantages or you are hesitant about using them.

### Bayesian Foundations

This Chapter provides a gentle technical introduction to Bayesian analysis using conjugate analysis, i.e. purely relying on distributions for which a closed-form posterior can be obtained. I focus mostly on the important and eminently tractable Bernoulli/binomial–Beta distribution, and on the Gaussian. The chapter develops valuable intuition for later parts, provides calculated examples showcasing the role of the prior, and develops intuition for the interpretation of results. If you are unsure whether to read this ask yourself whether you know how to derive a Gaussian posterior with unknown mean and variance. If the answer is no, then you should definitely read this part.

### Aggregate models

This section gives a gentle introduction to the use of Stan code to analyse decision-making data. I start from linear regression, and quickly move on from there to the estimation of nonlinear aggregate representative-agent models. I then cover individual-level (fixed effects) estimation, and how to make it more efficient. There is also a first treatment of regressions with individual-level parameters as dependent variables. If you have never coded a model in Stan, you should read this.

### Hierarchical modelling

The chapter provides an introduction to hierarchical modelling–the main strength of Bayesian analysis. I start from a brief discussion of the rationale behind hierarchical modelling. I then introduce hierarchical models in linear regression, starting from hierarchical intercepts and quickly moving on to hierarchical slopes. I then introduce hierarchies in nonlinear models, and how to make such estimations efficient. I briefly discuss regression analysis of such parameters. Subsequently, I show how to estimate covariance matrices of parameters, and I illustrate their effects using an example. The chapter also contains a discussion of meta-analysis, 2-stage regressions using a measurement-error setup, and of complex hierarchies ranging over 3+ levels.â€‹