Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lectures/stats_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ We verify the above and compute the mean and variance using `numpy`.

```{code-cell} ipython3
Benford_pmf = np.array([np.log10(1+1/d) for d in range(1,10)])
k = np.array(range(1,10))
k = np.arange(1, 10)

# mean
mean = np.sum(Benford_pmf * k)
mean = k @ Benford_pmf

# variance
var = np.sum([(k-mean)**2 * Benford_pmf])
var = ((k - mean) ** 2) @ Benford_pmf

# verify sum to 1
print(np.sum(Benford_pmf))
Expand Down
Loading