-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.Rmd
224 lines (145 loc) · 7.06 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
title: "Biodiversity Modelling Summer School"
author:
- name: Dominique Gravel, Ph.D.
affiliation: Université de Sherbrooke
- name: Andrew MacDonald, Ph.D.
affiliation: Université de Sherbrooke
- name: Willian Vieira, M. Sc.
affiliation: Université de Sherbrooke
date: "2021-08-16"
description: |
Evaluating ecological models with data
output:
distill::distill_article:
toc: true
toc_float: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
xaringanExtra::use_panelset()
# Learn more about creating websites with Distill at:
# https://rstudio.github.io/distill/website.html
# Learn more about publishing to GitHub Pages at:
# https://rstudio.github.io/distill/publish_website.html#github-pages
```
## Resources and exercises
**hemlock growth**
<small>
```{r message=FALSE, echo=TRUE}
hemlock <- readr::read_delim(
"https://raw.githubusercontent.com/bios2/biodiversity_modelling_2021/master/data/hemlock.txt",
delim = " ",
col_names = c("x","light", "growth"), skip = 1)
knitr::kable(head(hemlock, n = 3))
```
</small>
**Sutton trees**
```{r message=FALSE, echo=TRUE}
sutton <- readr::read_csv2("https://raw.githubusercontent.com/bios2/biodiversity_modelling_2021/master/data/sutton.csv")
knitr::kable(head(sutton, n = 3))
```
**States**
```{r, message=FALSE, echo=TRUE}
states <- readr::read_delim("https://raw.githubusercontent.com/bios2/biodiversity_modelling_2021/master/data/transitions.txt",
delim = " ",
col_names = c("x","ID", "temp", "state1",
"state2", "interval"),
skip = 1)
knitr::kable(head(states, n = 2))
```
* [Gibbs Sampler Example](gibbs_review.html): guided step-by-step approach for programming a gibbs sampler
* [Cumulative exercise](cumulative_exercise.html) in "collecting" a statistical distribution for use in practice.
* [Simulated annealing code](simulated_annealing.html), presented in 2 styles.
* [Metropolis hastings code](metropolis_example.html)
* [Grid search demo](grid_search.html)
* [Excercise problems](exercise_questions.html)
## Slides and lecture materials
::::: {.panelset}
::: {.panel}
[Probabilities and distributions]{.panel-name}
**16 August**
know your data, define your problem.
```{r share-again, echo=FALSE}
xaringanExtra::use_share_again()
```
```{r slides-intro, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/01_introduction.html", ratio = "16:9")
```
```{r slides-definitions, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/02_definitions.html", ratio = "16:9")
```
```{r slides-rules, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/03_rules.html", ratio = "16:9")
```
```{r slides-problem, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/04_problem.html", ratio = "16:9")
```
```{r slides-solutions, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/05_solutions.html", ratio = "16:9")
```
#### Univariate probability distributions
```{r slides-distributions, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/06_distributions.html", ratio = "16:9")
```
##### Continuous distributions
| distribution | positive or negative? | Quick description |
|--------------|-----------------------------|----------------------------------------------------------------|
| Normal | positive or negative values | Can result from many small effects added together |
| Lornormal | positive values only | results from many things multiplied together |
| Gamma | positive values only | can be the time to wait for a given number of things to happen |
| Exponential | Positive only | Lengths of time between random events |
| Beta | Positive only | Between 0 and 1. Can be any proportion. |
#### Discrete distributions
| distribution | positive or negative? | Quick description |
|-------------------|-----------------------|-----------------------------------------------------------------------------------------------------------------------|
| Poisson | Positive | Counting things that occur randomly over time |
| Negative Binomial | Positive | Counts of things as in the Poisson, but more variable. Also: the number of trials till a certain number of successes. |
| Binomial | Positive | Number of "successes" out of a number of trials, when probability of success is always the same |
:::
:::{.panel}
[Maximum likelihood methods]{.panel-name}
**18 August**
write down equations for your model.
```{r slides-likelihood, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/07_likelihood.html", ratio = "16:9")
```
```{r slides-likelihood-problem, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/08_likelihood_problem.html", ratio = "16:9")
```
```{r slides-likelihood-solution, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/09_likelihood_solution.html", ratio = "16:9")
```
:::
:::{.panel}
[Optimization]{.panel-name}
Once we know how to calculate likelihood, we can apply this to a very general statistical practice: how do we find parameters that maximize the likelihood of the data? this is an optimization problem
```{r slides-optimization, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/10_optimization.html", ratio = "16:9")
```
```{r slides-optimization-problem, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/11_optimization_problem.html", ratio = "16:9")
```
:::
:::{.panel}
[Bayesian statistics]{.panel-name}
```{r slides-bayes, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/12_Bayes.html", ratio = "16:9")
```
```{r slides-generative, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/13_generative.html", ratio = "16:9")
```
```{r slides-tree-problem, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/14_tree_models.html", ratio = "16:9")
```
:::
:::{.panel}
[Sampling algorithms]{.panel-name}
```{r slides-mcmc, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/15_mcmc.html", ratio = "16:9")
```
```{r slides-hmc, echo=FALSE, fig.cap="[Slides](slides/index.html)"}
xaringanExtra::embed_xaringan(url = "slides/16_stan.html", ratio = "16:9")
```
:::
::::