You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SD formulas and enhanced visualizations to multiple distributions
Completed for:
- Bernoulli: Add SD formula and mean line to PMF/CDF
- Geometric: Add SD formula, mean line, and mean±1SD region
- Negative Binomial: Add SD formula, mean line, and mean±1SD region
- Poisson: Add SD formula, mean line, and mean±1SD region
All visualizations now show:
- Red dashed line marking the mean
- Orange shaded region showing mean ± 1 standard deviation (where applicable)
- Legends with calculated values
- Increased figure sizes (10x5) for better readability
Still to do: Hypergeometric, Discrete Uniform, Categorical
The CDF shows the step function: starts at 0 for x < 0, jumps to 0.7 at x=0 (the value when outcome is 0), stays flat at 0.7 until x=1, then jumps to 1.0 at x=1 (the value when including both outcomes 0 and 1).
192
+
The CDF shows the step function: starts at 0 for x < 0, jumps to 0.7 at x=0 (the value when outcome is 0), stays flat at 0.7 until x=1, then jumps to 1.0 at x=1 (the value when including both outcomes 0 and 1). The red dashed line marks the mean.
177
193
178
194
Note: Here, P(X ≤ 0) = P(X = 0) = 0.7 because X can't take negative values; in general, "X ≤ 0" means "at or below 0", not "exactly 0".
179
195
@@ -865,6 +881,8 @@ This is why the formula captures "trials until first success" - it requires all
**Relationship to Other Distributions:** The Geometric distribution is built from independent **Bernoulli trials** and is a special case of the **Negative Binomial distribution** with $r=1$ (waiting for just one success instead of $r$ successes).
869
887
870
888
:::{admonition} Note
@@ -884,45 +902,63 @@ Let's visualize a Geometric distribution with $p = 0.4$ (our free throw example)
884
902
p_viz = 0.4
885
903
geom_viz = stats.geom(p=p_viz)
886
904
905
+
# Calculate mean and std (adjusted for trial number definition)
The PMF shows exponentially decreasing probabilities - you're most likely to succeed on the first few trials.
935
+
The PMF shows exponentially decreasing probabilities - you're most likely to succeed on the first few trials. The shaded region shows mean ± 1 standard deviation.
The CDF shows P(X ≤ k), the cumulative probability of achieving r successes within k trials.
1247
+
The CDF shows P(X ≤ k), the cumulative probability of achieving r successes within k trials. The red dashed line marks the mean.
1192
1248
1193
1249
:::{admonition} Example: Quality Control with r = 3, p = 0.05
1194
1250
:class: tip
@@ -1406,7 +1462,9 @@ For example, "4 calls per hour" could be modeled as 3600 one-second intervals wh
1406
1462
1407
1463
**Variance:** $Var(X) = \lambda$
1408
1464
1409
-
Note: Mean and variance are equal in a Poisson distribution.
1465
+
**Standard Deviation:** $SD(X) = \sqrt{\lambda}$
1466
+
1467
+
Note: Mean and variance are equal in a Poisson distribution, so the standard deviation is simply the square root of λ.
1410
1468
1411
1469
**Relationship to Other Distributions:** The Poisson distribution is an approximation to the **Binomial distribution** when $n$ is large, $p$ is small, and $\lambda = np$ is moderate. Rule of thumb: use Poisson approximation when $n \ge 20$ and $p \le 0.05$.
1412
1470
@@ -1421,45 +1479,63 @@ Let's visualize a Poisson distribution with $\lambda = 4$ (our call center examp
The PMF shows the distribution centered around λ = 4 with reasonable probability for nearby values.
1512
+
The PMF shows the distribution centered around λ = 4 with reasonable probability for nearby values. The shaded region shows mean ± 1 standard deviation ($\sqrt{4} = 2$).
0 commit comments