Skip to content

Commit 1a46d9d

Browse files
authored
misc (#541)
1 parent a58c4af commit 1a46d9d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lectures/prob_dist.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ Check that your answers agree with `u.mean()` and `u.var()`.
160160
Another useful distribution is the Bernoulli distribution on $S = \{0,1\}$, which has PMF:
161161

162162
$$
163-
p(i) = \theta^{i-1} (1 - \theta)^i
163+
p(i) = \theta^i (1 - \theta)^{1-i}
164+
\qquad (i = 0, 1)
164165
$$
165166

166167
Here $\theta \in [0,1]$ is a parameter.
@@ -171,7 +172,7 @@ We can think of this distribution as modeling probabilities for a random trial w
171172
* $p(0) = 1 - \theta$ means that the trial fails (takes value 0) with
172173
probability $1-\theta$
173174

174-
The formula for the mean is $p$, and the formula for the variance is $p(1-p)$.
175+
The formula for the mean is $\theta$, and the formula for the variance is $\theta(1-\theta)$.
175176

176177
We can import the Bernoulli distribution on $S = \{0,1\}$ from SciPy like so:
177178

@@ -186,11 +187,10 @@ Here's the mean and variance at $\theta=0.4$
186187
u.mean(), u.var()
187188
```
188189

189-
Now let's evaluate the PMF
190+
We can evaluate the PMF as follows
190191

191192
```{code-cell} ipython3
192-
u.pmf(0)
193-
u.pmf(1)
193+
u.pmf(0), u.pmf(1)
194194
```
195195

196196
#### Binomial distribution
@@ -756,7 +756,11 @@ x.mean(), x.var()
756756
```{exercise}
757757
:label: prob_ex4
758758
759-
Check that the formulas given above produce the same numbers.
759+
If you try to check that the formulas given above for the sample mean and sample
760+
variance produce the same numbers, you will see that the variance isn't quite
761+
right. This is because SciPy uses $1/(n-1)$ instead of $1/n$ as the term at the
762+
front of the variance. (Some books define the sample variance this way.)
763+
Confirm.
760764
```
761765

762766

0 commit comments

Comments
 (0)