Bayesian Hierarchical Models in Ecology
1
Background
1.1
How to Use This Book
1.2
Acknowledgments
1.3
Motivation
2
The Model Matrix and Random Effects
2.1
Linear Models
2.1.1
Stochastic Component
2.1.2
Distributions
2.1.3
Linear Component
2.1.4
Parameterization
2.2
Model Effects
2.2.1
Fixed Effects
2.2.2
Random Effects
2.3
Hierarchical Models
2.3.1
Definitions of Hierarchical Models
3
Fundamentals of Bayesian Inference
3.1
Models vs. Estimation
3.1.1
Model Building
3.1.2
Case Study: Explanation vs Prediction
3.1.3
Models vs Estimation
3.1.4
What is a parameter?
3.2
Bayesian Basics
3.2.1
Why learn Bayesian estimation?
3.2.2
Bayesian vs. Frequentist Comparison
3.2.3
Bayesians use Bayes’ Rule for inference
3.2.4
Breaking down Bayes’ Rule
3.3
Bayesian and Frequentist Comparison
3.3.1
Example with Data
3.3.2
More differences
3.3.3
Put another way
3.3.4
Uncertainty: Confidence Interval vs Credible Interval
3.3.5
Bayesian Pros and Cons
4
Bayesian Machinery
4.1
Bayes’ Rule
4.1.1
Posterior Distribution:
\(p(\theta | y)\)
4.1.2
Likelihood Function:
\(p(y | \theta)\)
4.2
Priors:
\(p(\theta)\)
4.3
Normalizing Constant:
\(P(y)\)
4.3.1
MCMC Background
4.3.2
MCMC Example
4.3.3
Gibbs Sampling
4.3.4
Burn-in
4.3.5
Convergence
4.3.6
Thinning
4.3.7
MCMC Summary
5
Introduction to JAGS
5.1
WinBUGS
5.1.1
BUGS? JAGS?
5.1.2
STAN?
5.2
JAGS
5.2.1
General steps to fitting a model in JAGS
5.2.2
Define the BUGS Model: Types of Nodes
5.2.3
Arrays and Indexing
5.2.4
Repeated Structures
5.2.5
Likelihood Specification
5.2.6
BUGS Syntax
5.2.7
Simple Example
5.2.8
Derived Quantities
5.3
Convergence
5.4
Additional Resources
5.5
JAGS in R: Model of the Mean
5.5.1
Generate some date
5.5.2
Define Model
5.5.3
Bundle Data
5.5.4
Initial Values
5.5.5
MCMC Settings
5.5.6
Parameters to Monitor
5.5.7
Run JAGS model
5.5.8
Assess Convergence and Model Output
6
Simple Models in JAGS
6.1
Revisiting Hierarchical Structures
6.1.1
What is a hierarchical model?
6.1.2
Hierarchical Model Example
6.1.3
Borrowing Strength?
6.1.4
Shrinkage toward the grand mean (
\(\mu_\alpha\)
)
6.2
Simple Linear Regression
6.2.1
Varying Coefficient Models
6.3
Varying Intercept Model
6.3.1
Nested Indexing
6.3.2
Intraclass correlation coefficient (ICC)
6.3.3
Varying Intercept, Fixed Slope Model
6.4
Varying Slope Model
6.4.1
Correlation between parameters
6.4.2
Correlation between 2 or more varying parameters
7
Varying Coefficients
8
Generalized Linear Models in JAGS
8.1
Background to GLMs
8.2
Components of a GLM
8.2.1
Common GLMs
8.3
Binomial Regression
8.4
Poisson Regression
8.4.1
Poisson Extras
9
Plotting
10
Within-subjects Model
11
Hierarchical Models
References
Published with bookdown
Bayesian Hierarchical Models in Ecology
Chapter 10
Within-subjects Model