-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06_distributions.Rmd
182 lines (132 loc) · 2.8 KB
/
06_distributions.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
---
title: "Univariate Probability Distributions"
author: "Andrew MacDonald"
date: "August 18th, 2021"
output:
xaringan::moon_reader:
css: [default, assets/ecl707.css, "hygge"]
lib_dir: "assets"
seal: false
nature:
highlightStyle: monokai
highlightLines: true
countIncrementalSlides: false
beforeInit: "assets/macros.js"
---
class: title-slide, middle
<style type="text/css">
.title-slide {
background-image: url('assets/img/bg.jpg');
background-color: #23373B;
background-size: contain;
border: 0px;
background-position: 600px 0;
line-height: 1;
}
</style>
# A Field Guide to the Univariate Distributions
<hr width="65%" align="left" size="0.3" color="orange"></hr>
## Introduction
<hr width="65%" align="left" size="0.3" color="orange" style="margin-bottom:40px;" alt="@Martin Sanchez"></hr>
.instructors[
**Biodiversity Modelling** - Andrew MacDonald
]
<img src="assets/img/bg.jpg" width="25%" style="margin-top:20px;"></img>
---
<div style='text-align:center;'>
<img src="assets/img/meme.jpg" width="400px"></img>
</div>
---
# Two flavours
--
### Discrete Distributions (integers, counts of things)
Described with a **probability mass function**
--
### Continuous distributions (not integers!)
Described with a **probability density function**
---
## Discrete distributions
$$
0 \leq [z] \leq 1
$$
--
$$
\sum [z] = 1
$$
---
## Continuous Distributions
$$
0 \leq [z]
$$
--
$$
\int_-^+[z]d[z] = 1
$$
---
## Moments
$$
\mu = \text{E}(z) = \sum z[z]
$$
---
$$
\sigma^2 = \text{E}((z-\mu)^2) = \sum (z - \mu)^2[z]
$$
class: inverse, middle, center
---
---
# The Binomial Distribution
<hr width="65%" size="0.3" color="orange" style="margin-top:-20px;"></hr>
---
class: inverse, middle, center
# The Binomial Distribution
<hr width="65%" size="0.3" color="orange" style="margin-top:-20px;"></hr>
---
.pull-left[
```{r binom, fig.show = 'hide'}
curve(dbinom(x,
size = 20,
p = 0.2),
n = 21,
type = "p",
xlim = c(0,20))
```
Probability Mass Function is
$$
\text{Pr}(y = k) = {n \choose k} p^k(1-p)^{n-k}
$$
]
.pull-right[
```{r ref.label = 'binom', echo = FALSE, fig.dim=c(6.5, 9.5)}
```
]
---
.pull-left[
```{r binom2, fig.show = 'hide'}
curve(dbinom(x,
size = 20,
p = 0.2),
n = 21,
type = "p",
xlim = c(0,20))
curve(dbinom(x,
size = 20,
p = 0.8),
n = 21,
type = "p",
col = "red", add = TRUE, pch = 16)
curve(dbinom(x,
size = 20,
p = 0.1),
n = 21,
type = "p",
col = "blue", add = TRUE, pch = 16)
```
Probability Mass Function is
$$
\text{Pr}(y = k) = {n \choose k} p^k(1-p)^{n-k}
$$
]
.pull-right[
```{r ref.label = 'binom2', echo = FALSE, fig.dim=c(6.5, 9.5)}
```
]