Skip to content

Commit 4275553

Browse files
author
Lauren Talluto
committed
Updates for HM
1 parent f568583 commit 4275553

File tree

4 files changed

+225
-192
lines changed

4 files changed

+225
-192
lines changed

index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ This course will cover the basics of Bayesian statistical methods with applicati
9696
<td>
9797
9898
<p class = "ex"><a href = "ex/ex5_kung.html">!Kung height</a></p>
99-
<!--<p class = "soln"><a href = "ex/soln">Solutions</a></p>-->
99+
<p class = "soln"><a href = "ex/soln">Solutions</a></p>
100100
<p class = "ex"><a href = "ex/ex6_birddiv_glm.html">Bird diversity</a></p>
101101
</td>
102102
</tr>

lec/5_regression.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ parameters {
901901
vector [k] B;
902902
}
903903
transformed parameters {
904-
vector eta = a + X * B;
904+
vector [n] eta = a + X * B;
905905
}
906906
model {
907907
y ~ normal(eta, s);

lec/7_hm.Rmd

+25-11
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,9 @@ transformed parameters {
892892
893893
```
894894

895-
```{r tsuga_unpooled_compile, cache = TRUE, message = FALSE, error = FALSE, echo = FALSE}
895+
```{r tsuga_unpooled_compile, results = 'hide', cache = TRUE, message = FALSE, error = FALSE, echo = FALSE}
896896
# compile the model (below)
897-
tsuga_unpooled = stan_model("../vu_advstats_students/stan/tsuga_unpooled.stan")
897+
tsuga_unpooled <- stan_model("../vu_advstats_students/stan/tsuga_unpooled.stan")
898898
```
899899

900900

@@ -975,12 +975,13 @@ grid.arrange(pl_probs_unpooled, pl_err_unpooled, ncol=2)
975975
:::: {.column}
976976

977977
* We don't really expect each year to be independent
978-
- it's all one species, response to temperature should be similar
978+
- it's all one species, response to precipitation should be similar
979979
- some years are better or worse than others
980-
* Imagine instead there is a population of possible years, each with its own mortality
981-
* This population has a true mean and a true variance
982-
* The samples we've taken will come from that distribution
983-
* This can tell us something about all possible years, not just these years
980+
981+
> - Imagine instead there is a population of possible years, each with its own mortality
982+
> - This population has a true mean and a true variance
983+
> - The samples we've taken will come from that distribution
984+
> - This can tell us something about all possible years, not just these years
984985
985986

986987
::::
@@ -1179,11 +1180,25 @@ grid.arrange(pl_intervals_pooled + ggtitle("Pooled"),
11791180
```
11801181

11811182

1183+
## When do we need hierarchical models?
1184+
> - Repeated sampling within units (e.g., samples nested within plots/individuals)
1185+
> - Inference at multiple levels of organisation (e.g., Covariates at multiple spatial scales)
1186+
> - Uneven sampling among units (Number of trees by year)
1187+
> - Accounting for nonindependence of samples
1188+
11821189
## When do we need hierarchical models?
11831190
* Repeated sampling within units (e.g., samples nested within plots/individuals)
1184-
* Inference at multiple levels of organisation
1185-
- Covariates at multiple spatial scales
1186-
* Uneven sampling among units
1191+
* Inference at multiple levels of organisation (e.g., Covariates at multiple spatial scales)
1192+
* Uneven sampling among units (Number of trees by year)
1193+
* Accounting for nonindependence of samples
1194+
* Avoiding pre-averaging
1195+
- Don't: perform repeat samples on a unit, perform analysis on the average
1196+
- Do: Build an HM accounting for variability within and among units
1197+
1198+
## When do we need hierarchical models?
1199+
* Repeated sampling within units (e.g., samples nested within plots/individuals)
1200+
* Inference at multiple levels of organisation (e.g., Covariates at multiple spatial scales)
1201+
* Uneven sampling among units (Number of trees by year)
11871202
* Accounting for nonindependence of samples
11881203
* Avoiding pre-averaging
11891204
- Don't: perform repeat samples on a unit, perform analysis on the average
@@ -1192,7 +1207,6 @@ grid.arrange(pl_intervals_pooled + ggtitle("Pooled"),
11921207
- All mixed models are hierarchical, not all hierarchical models are mixed models
11931208

11941209

1195-
11961210
## Designing hierarchical models in Stan
11971211
::: {.columns}
11981212
:::: {.column}

0 commit comments

Comments
 (0)