MTH-361A | Spring 2025 | University of Portland
February 17, 2025
The Law of Large Numbers
It states that as the number of trials in a random experiment increases, the sample mean approaches the expected value.
Example Bernoulli Trials Simulation
Let \(p=0.60\) be the “success” probability of a Bernoulli r.v. \(X\), where \(\text{E}(X) = p\).
Geometric R.V.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Geom}(p) \\ \text{PMF } & \longrightarrow P(X=k) = (1-p)^k p \\ \text{for } & k = 0,1,2, \cdots \end{aligned} \]
Binomial R.V.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Binom}(p) \\ \text{PMF } & \longrightarrow P(X=k) = \binom{n}{k} p^k (1-p)^{n-k} \\ \text{for } & k = 0,1,2,3, \cdots, n \end{aligned} \]
Geometric Distribution
Geometric R.V.
Let \(p=0.50\) be the success probability.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Geom}(0.50) \\ \text{PMF } & \longrightarrow P(X=k) = (1-0.50)^k (0.50) \\ \text{for } & k = 0,1,2, \cdots \end{aligned} \]
Geometric Distribution
Example:
What is the probability of “success” on the 6th trial with \(p=0.50\)? \[ \begin{aligned} P(X=5) & = (1-0.50)^5 (0.50) \\ & \approx 0.016 \end{aligned} \]
Using R:
## [1] 0.015625
\(\star\) Note that the
dgeom()
function computes the probability \(P(X = k)\), meaning it computes the
probability at exactly \(X=k\) using
the Geometric PMF.
Geometric Distribution
Example:
What is the probability that the first “success” occurs before the 6th trial, given \(p=0.50\)? \[ \begin{aligned} P(X \le 5) & = \sum_{k=0}^5 P(X = k) \\ & = \sum_{k=0}^5 (1-0.50)^{k} (0.50) \\ P(X \le 5) & \approx 0.984 \\ \end{aligned} \]
Using R:
## [1] 0.984375
\(\star\) Note that the
pgeom()
function computes the probability \(P(X \le k)\), meaning it computes the sum
of all probabilities from \(X=0\) to
\(X=k\) using the Geometric PMF.
Geometric Distribution with Expected Value
Geometric R.V.
Let \(p=0.50\) be the success probability.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Geom}(0.60) \\ \text{PMF } & \longrightarrow P(X=k) = (1-0.50)^k (0.50) \\ \text{for } & k = 0,1,2, \cdots \\ \text{expected value} & \longrightarrow \text{E}(X) \approx 0.667 \end{aligned} \]
In general, the expected value of the Geometric r.v. is given by \[\text{E}(X) = \frac{1-p}{p},\] which is the ratio of the “fail” and “success” probabilities.
Random Sampling from the Geometric Distribution
Sample Mean vs the Expected Value
The sample mean of \(0.88\) is not exactly equal to the expected value of \(1\) due to sampling variability. As we increase the number of samples, the sample mean gets closer to the expectation.
Geometric Random Sampling using R
Binomial Distribution
Binomial R.V.
Let \(p=0.50\) be the success probability and \(n=10\) the number of trials.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Binom}(p) \\ \text{PMF } & \longrightarrow P(X=k) = \binom{n}{k} p^k (1-p)^{n-k} \\ \text{for } & k = 0,1,2,3, \cdots, n \end{aligned} \]
Binomial Distribution
Example:
What is the probability of getting 4 “success” in 10 trials with \(p=0.50\)? \[ \begin{aligned} P(X=4) & = \binom{10}{4} (0.50)^4 (1-0.50)^{n-k} \\ & \approx 0.205 \end{aligned} \]
Using R:
## [1] 0.2050781
\(\star\) Note that the
dbinom()
function computes the probability \(P(X = k)\), meaning it computes the
probability at exactly \(X=k\) using
the Binomial PMF.
Binomial Distribution
Example:
What is the probability of getting at most 4 “success” in 10 trials with \(p=0.50\)? \[ \begin{aligned} P(X \le 4) & = \sum_{k=0}^4 P(X = k) \\ & = \sum_{k=0}^4 \binom{10}{k} (0.50)^k (1-0.50)^{10-k} \\ P(X \le 4) & \approx 0.377 \\ \end{aligned} \]
Using R:
## [1] 0.3769531
\(\star\) Note that the
pbinom()
function computes the probability \(P(X \le k)\), meaning it computes the sum
of all probabilities from \(X=0\) to
\(X=k\) using the Binomial PMF.
Binomial Distribution with Expected Value
Binomial R.V.
Let \(p=0.50\) be the success probability and \(n=10\) the number of trials.
\[ \begin{aligned} \text{R.V. } & \longrightarrow X \sim \text{Binom}(p) \\ \text{PMF } & \longrightarrow P(X=k) = \binom{n}{k} p^k (1-p)^{n-k} \\ \text{for } & k = 0,1,2,3, \cdots, n \\ \text{expected value} & \longrightarrow \text{E}(X) \approx 5 \end{aligned} \]
In general, the expected value of the Binomial r.v. is given by \[\text{E}(X) = np,\] which is the number of expected “success” in \(n\) trials.
Random Sampling from the Geometric Distribution
Sample Mean vs the Expected Value
The sample mean of \(4.74\) is not exactly equal to the expected value of \(5\) due to sampling variability. As we increase the number of samples, the sample mean gets closer to the expectation.
Geometric Random Sampling using R
R.V. \(X\) | Geometric | Binomial |
---|---|---|
Description | number of “fail” trials before a “success” | number of “success” in \(n\) trials |
Sampling | with replacement | with replacement |
Parameters | \(p \longrightarrow\) probability of “success” | \(n \longrightarrow\)
number of trials \(p \longrightarrow\) probability of “success” |
PMF | \(P(X=k) = (1-p)^k
p\) \(k=0,1,2,\cdots\) |
\(P(X=k) = \binom{n}{k} p^k
(1-p)^{n-k}\) \(k = 0,1,2,3, \cdots, n\) |
Expected Value \(\text{E}(X)\) | \(\frac{1-p}{p}\) | \(np\) |
\(P(X = k)\) | dgeom(p) |
dbinom(n,p) |
\(P(X \le k)\) | pgeom(p) |
pbinom(n,p) |
\(N\) Simulations | rgeom(N,p) |
rbinom(N,n,p) |
\(\star\) Key Idea The basis for both Geometric and Binomial r.v. is the Bernoulli trials but with different counting methodology of “successes”.
.Rmd
file by replacing [name]
with your name
using the format [First name][Last initial]
. Then, open the
.Rmd
file.