9 Day 9 (February 17)
9.1 Announcements
Start reading Ch. 4 pgs 137-192
Questions/clarifications from journals
- Quick coin flip example that addresses the three questions below (R code here)
- “I am struggling to fully grasp the why behind generating simulated data from our model (like in the Whooping Crane example). I understand how to generate this fake data, but I am unclear on the practical utility of doing so. If we already have the real data, what specific insight do we gain by seeing if our model can reproduce it? I am trying to understand if this is purely a validation step to check model fit, or if this simulated data has other uses in inference”
- “With rejection sampling, there is a part of me that’s still struggling with understanding how rejection sampling is able to generate data that matches the observed data exactly. Wouldn’t there be some aspect of randomness in the real data that would make generated data exactly matching it up to chance? -”One thing I’m still struggling to understand is how rejection sampling does not result in overfitting. Having learned a little about over fitting, I am struggling with the idea of selecting too perfect of a model.
9.2 Hierarchical models
- During this course we will implement many models using the hierarchical framework
- Hierarchical models are pretty common (e.g., mixed models, kriging, most Bayesian models)
- Today is a crash course on hierarchical and Bayesian statistical models
- Study technical note 1.1 on pg. 13 of Spatio-temporal statistics with R
- The Bayesian hierarchical modeling framework
\[\text{Data model:} \;\;[\mathbf{z}|\mathbf{y},\boldsymbol{\theta}_{D}]\] \[\text{Process model:} \;\;[\mathbf{y}|\boldsymbol{\theta}_{P}]\] \[\text{Parameter model:} \;\;[\boldsymbol{\theta}]\]
- Given a Bayesian hierarchical model we want the following:
- The posterior distribution of the parameters \([\boldsymbol{\theta}|\mathbf{z}]\)
- The posterior predictive distribution \([\mathbf{z}_{\text{pred}}|\mathbf{z}]\)
- Using Bayes’ theorem…
\[[\boldsymbol{\theta}|\mathbf{z}]=\int\frac{[\mathbf{z}|\mathbf{y},\boldsymbol{\theta}][\mathbf{y}|\boldsymbol{\theta}][\boldsymbol{\theta}]}{\int\int\mathbf{[z}|\mathbf{y},\boldsymbol{\theta}][\mathbf{y}|\boldsymbol{\theta}][\boldsymbol{\theta}]d\mathbf{y}d\mathbf{\boldsymbol{\theta}}}d\mathbf{y}\]
\[[\mathbf{z}_{\text{pred}}|\mathbf{z}]=\int\int\mathbf{[z}_{\text{pred}}|\mathbf{y},\boldsymbol{\theta}][\mathbf{y}|\boldsymbol{\theta}][\boldsymbol{\theta}|\mathbf{z}]d\mathbf{y}d\mathbf{\boldsymbol{\theta}}\]
- White board whooping crane example of BHM.
- Example 1 R code
- Example 2 R code