Preface
Setting the stage
1
Introduction
1.1
What does your theory say about your data?
1.2
What do your data say about your theory?
1.3
What do your parameters say about other things?
1.4
What does your expertise say about your parameters?
2
Getting started in
Stan
2.1
Installation in
R
2.2
The anatomy of a
Stan
program
2.2.1
Data block
2.2.2
Transformed data block
2.2.3
Parameters block
2.2.4
Model block
2.2.5
Generated quantities block
2.2.6
The final product
2.3
Estimating a model
2.4
Looking at the results
3
Probabilistic models of behavior
3.1
The problem with deterministic models
3.2
What
is
a probabilistic model?
3.3
Example dataset and model
3.4
Optimal choice plus an error
3.4.1
Estimating a model
3.5
Utility-based models
3.5.1
Estimating a model
3.5.2
Doing something with the estimates
4
Considerations for choosing a prior
4.1
Example model and experiment
4.2
Getting the support right
4.3
Eliciting reasonable priors
4.3.1
Parameter values and the prior pushforward check
4.3.2
Predictions and other derived quantities: The prior predictive check
4.4
Assessing the sampling performance of a prior
4.4.1
Does our model recover its parameters well?
4.4.2
Do we see any pathologies in the estimation process?
4.5
R
code used for this chapter
Building blocks
5
Representative agent and participant-specific models
5.1
Participant-specific models
5.1.1
Example data and economic model
5.1.2
Going to the probabilistic model
5.1.3
A short side quest into canned estimation techniques
5.1.4
Assigning priors
5.1.5
Estimating the model for one participant
5.1.6
Estimating the model for all participants
5.1.7
But we could be learning more!
5.2
Actual representative agent models (pooled models)
6
Hierarchical models
6.1
A random sample of participants walks into your lab
6.2
The anatomy of a basic hierarchical model
6.3
Accounting for unobserved heterogeneity
6.3.1
The last time you will integrate the likelihood, probably
6.3.2
Data augmentation
6.4
A multivariate normal hierarchical model
6.4.1
Decomposing the variance-covariance matrix
6.4.2
Transformed parameters and normal distributions
6.5
Example: again with
Bruhin, Fehr, and Schunk (2019)
6.5.1
No correlation between individual-level parameters
6.5.2
Correlation between individual-level parameters
7
Making inferences about an individual participant using hierarchical models
7.1
Example dataset and model
7.1.1
What are we trying to estimate?
7.1.2
The RDU model
7.1.3
Adding an error term
7.2
Using just Participant 61’s data
7.2.1
Estimating the model’s fundamental parameters
7.2.2
Estimating the things we actually want to estimate
7.2.3
Implementation in
Stan
7.3
OK, but we have a better tool for this
7.3.1
What is the hierarchical model doing for our prior?
7.3.2
Participant 61’s fundamental parameters
7.3.3
The transforms that we care about
R
code used for this chapter
8
Mixture models
8.1
A menu of models
8.2
Dichotomous and toolbox mixture models
8.3
Coding peculearities
8.4
Example experiment:
Andreoni and Vesterlund (2001)
8.4.1
As basic as it gets
8.4.2
Adding some heterogeneity
8.5
Some code used to estimate the models
9
Filling in the blanks: Imputation
9.1
Example model and dataset: yet again with
Bruhin, Fehr, and Schunk (2019)
9.2
How is this going to work?
9.3
Implementation
9.4
Results
9.4.1
Using the correlation matrix
9.4.2
The correlation matrix is doing a lot of heavy lifting here
9.5
Conclusion
9.6
R
code used for this chapter
Acknowedgements
10
More filling in the blanks: data augmentation
10.1
Example 1: two ways to estimate a probit model
10.2
Example 2: accounting for rounded answers
10.2.1
The
Holt and Smith (2016)
task
10.2.2
A model for behavior in
Holt and Smith (2016)
10.2.3
A note on replication
10.2.4
Augmenting the data
10.2.5
Results
10.3
R
code used for this chapter
10.3.1
Loading the data
10.3.2
Estimating the models
11
Using your structural estimates as explanatory variables in regression models
11.1
Example 1: a probit model with risk preferences measured by
Holt and Laury (2002)
.
11.2
Example 2: A random effects logit model with risk and time preferences.
11.3
Example 3: Logit and ordered logit with risk preferences from
Gneezy and Potters (1997)
11.4
A note of caution
11.5
Conclusion
11.6
R
code used for this chapter
11.6.1
Example 1
11.6.2
Example 2
11.6.3
Example 3
12
Model evaluation
12.1
Example dataset and models
12.2
Model posterior probabilities
12.2.1
Implementation using bridge sampling and the
bridgesampling
library
12.3
Cross-validation
12.3.1
Expected Log Predicted Density (ELPD) and other measures of goodness of fit
12.3.2
1-round cross-validation
12.3.3
Leave-one-out cross-validation (LOO)
12.3.4
Approximate LOO
12.3.5
\(k\)
-fold cross-validation
13
Speeding up your
Stan
code
13.1
Example dataset and model
13.2
A really slow way to estimate the model
13.3
Pre-computing things
13.4
Vectorization
13.5
Within-chain parallelization with
reduce_sum()
13.6
Evaluating the implementations
13.6.1
Pre-computing and vectorization
13.6.2
Within-chain parallelization
13.7
R
code to estimate models
13.7.1
Slow, pre-computed, and vectorized models
13.7.2
Parallelized model
Applications
14
Application: Experience-Weighted Attraction
14.1
The model at the individual level
14.2
Some computational and coding issues
14.3
Representative agent models
14.3.1
Prior calibration
14.3.2
The
Stan
model
14.3.3
Results
14.4
Hierarchical model
14.4.1
Prior calibration
14.4.2
The
Stan
model
14.4.3
Results
14.5
Some code used to estimate the models
14.5.1
Loading the data
14.5.2
Estimating the representative agent models
14.5.3
Estimating the hierarchical model
15
Application: Strategy Frequency Estimation
15.1
Simplifying the individual likelihood functions
15.2
Example experiment:
Dal Bó and Fréchette (2011)
15.2.1
The SFEM with homogeneous trembles
15.2.2
Adding heterogeneous trembles and integrating the likelihood
15.3
R
code to do these estimations
16
Application: Strategy frequency estimation with a mixed strategy
16.1
Example dataset and strategies
16.2
The likelihood function
16.3
Implementation in
Stan
16.4
Results
16.5
R
code used to estimate the models
17
Computing Quantal Response Equilibrium
17.1
Overview of quantal response equilibrium
17.2
Computing Quantal Response Equilibrium
17.2.1
Setting up the problem
17.2.2
A predictor-corrector algorithm
17.2.3
Initial conditions
17.2.4
Algorithm tuning
17.3
The predictor-corrector algorithm in
R
17.4
Some example games
17.4.1
Generalized matching pennies
(Ochs 1995)
17.4.2
Stag hunt
17.4.3
\(n\)
-player Volunteer’s Dilemma imposing symmetric strategies
18
Application: Quantal Response Equilibrium and the Volunteer’s Dilemma
(Goeree, Holt, and Smith 2017)
18.1
Solving logit QRE and estimating the model
18.2
Adding some heterogeneity
18.2.1
Computing quantal response equilibrium with heterogeneous parameters
18.2.2
Warm glow volunteering
18.2.3
Duplicate aversion
18.2.4
Results
18.3
R
code to run estimations
19
Application: A Quantal Response Equilibrium with discrete types
19.1
Example dataset and models
19.2
A note on replication
19.3
Three models that make different assumptions about bracketing
19.3.1
Broad bracketing only
19.3.2
Narrow bracketing only
19.3.3
A mixture of broad and narrow bracketing
19.4
Results
19.5
R
code used to estimate these models
20
Application: QRE in a Bayesian game and cursed equilibrium
20.1
Example game and dataset
20.2
Solving for QRE
20.2.1
Baseline model
20.2.2
Cursed equilibrium
20.3
A quick prior calibration
20.4
Model results
20.5
Model evaluation
20.6
R
code used in this chapter
21
Application: Some more extensions to the logit quantal response equilibrium model
21.1
Example dataset
21.2
Solving the QRE condition
21.3
Foreshadowing what I want in my
Stan
programs
21.3.1
There will be a lot of repetition in the code
21.3.2
Checking that the QRE-solver has converged
21.3.3
Model selection
21.4
Models under consideration
21.4.1
The baseline QRE model
21.4.2
Risk aversion
21.4.3
Equilibrium (sort-of) on average
21.4.4
Heterogeneous parameters
21.5
Results
21.6
Visualizing some of the models’ predictions
21.7
Selecting a model and using it to make an out-of-sample prediction
R
code for this chapter
22
Application: Level-
\(k\)
models
22.1
Data and game
22.2
The level-
\(k\)
model
22.2.1
The deterministic component of the model
22.2.2
Exact and probabilistic play
22.3
Assigning probabilities to types for each participant separately
22.3.1
The
Stan
program
22.3.2
Prior calibration
22.3.3
Results
22.4
Doing the averaging within one program
22.4.1
The
Stan
program
22.4.2
Results
22.5
A mixture model
22.5.1
Stan
program
22.5.2
A prior for
\(\psi\)
22.5.3
Results
22.6
A mixture over levels and hierarchical nuisance parameters
22.6.1
Prior calibration
22.6.2
Stan
program
22.6.3
Results
22.7
A different assumption about mixing
22.7.1
Stan
program
22.7.2
Results
22.8
R
code to estimate the models
22.8.1
Participant-specific estimation conditional on
\(k\)
with Bayesian model averaging
22.8.2
Participant-specific estimation with a prior over
\(k\)
22.8.3
Mixture model
22.8.4
Hierarchical model
22.8.5
Mixture model with beliefs consistent with truncated type distribution
23
Application: Estimating risk preferences
23.1
Example dataset
23.2
We might not just be interested in the parameters
23.3
Introducing some important models
23.3.1
Expected utility theory
23.3.2
Rank-dependent utility
(Quiggin 1982)
23.3.3
Comparing the certainty equivalents estimated using EUT and RDU
23.4
A hierarchical specification
23.4.1
Population-level estimates
23.4.2
Participant-level estimates
23.5
R
code used to estimate these models
24
Application: Meta-analysis using (some of) the METARET data
24.1
Data
24.2
A basic model
24.3
But the data are really interval-valued!
24.4
Heterogeneous standard deviations
24.5
Student-
\(t\)
distributions, because why not?
24.6
R
code to estimate the models
25
Application: choice bracketing
25.1
Data and model
25.2
Representative agent and individual estimation
25.3
Hierarchical model
25.4
A mixture model
25.5
What do we get out of the structural models, and what could we miss?
26
Application: Ranked choices and the Thurstonian model
26.1
The Thurstonian model
26.2
Computational issues
26.3
Example dataset and model
26.4
A representative agent model
26.5
A hierarchical model
26.6
R
code used to run this
Links to data
References
Structural Bayesian Techniques for Experimental and Behavioral Economics
Setting the stage