# Chapter 11: Probability models for counts

STAT 1010 - Fall 2022

# Learning outcomes

By the end of this lesson you should:

• Know how to use the binomial distribution, as well as its mean, and variance.
• Know how to use the Poisson distribution, as well as its mean, and variance.
• Understand differences between the binomial and Poisson distributions, and when the two could be applied.

# Bernoulli trial

• flipping a coin

• insured or not insured

• luggage lost or not lost

• $$$B =\begin{cases} 1, & \text{if the trial is a success}.\\ 0, & \text{if the trial is not a success}. \end{cases}$$$

• $p$ is the probability of success

## E(Bernoulli)

• $E(B) = 0 \cdot P(B=0) + 1 \cdot P(B=1)$
• \begin{aligned} E(B) &= 0 \cdot P(B=0) + 1 \cdot P(B=1)\\ &= 0 \cdot (1-p) + 1 \cdot p\\ &= p \end{aligned}
02:00

## Var(Bernoulli)

• $Var(B) = (0 - p)^2 \cdot P(B=0) + (1 - p)^2 \cdot P(B=1)$
• \begin{aligned} Var(B) &= (0 - p)^2 \cdot P(B=0) + (1 - p)^2 \cdot P(B=1)\\ &= p^2 \cdot (1-p) + (1 - p)^2 \cdot p\\ &= p^2 - p^3 + p(1 - 2p + p^2) \\ &= p^2 - p^3 + p - 2p^2 + p^3\\ &= p(1-p) \end{aligned}
02:00

## Multiple Bernoulli trials

This happens so often that we have another name for this distribution

$Y = B_1 + B_2 + ... + B_n$

• $Y$ is the sum of independent and identically distributed random variables
• What is the mean and variance?

# Binomial distribution - FIST

The number of successes in $n$ trials

• Binomial - Biceps - FIST

• F - fixed number of trials

• I - independent outcomes

• S - probability of success is constant

• T - two outcomes

## E(Binomial)

$E(Y) = E(B_1 + B_2 + ... + B_n)$

• \begin{aligned} E(Y) &= E(B_1) + E(B_2) + ... + E(B_n) \\ &= p + p + ... + p \\ &= np \end{aligned}
02:00

## Var(Binomial)

$Var(Y) = Var(B_1 + B_2 + ... + B_n)$

• \begin{aligned} Var(Y) &= Var(B_1) + Var(B_2) + ... + Var(B_n) \\ &= p(1-p) + p(1-p) + ... + p(1-p) \\ &= np(1-p) \end{aligned}
02:00

## Counting things

In a class of 85 students how many groups of 4 are possible?

• $85 \cdot 84 \cdot 83 \cdot 82$

• $48,594,840$ groups

• If we don’t care about order

• $\frac{85 \cdot 84 \cdot 83 \cdot 82}{4 \cdot 3 \cdot 2 \cdot 1}$

• $2,024,785$ groups

• Combination written as ${}_{n}C_{k}$ here $n = 85$, $k = 4$ or $\binom{85}{4}$

exp(lfactorial(85))/exp(lfactorial(81))
[1] 48594840
exp(lfactorial(85))/(exp(lfactorial(81))*exp(lfactorial(4)))
[1] 2024785

## Binomial pdf

If $Y \sim Bin(n, p)$ where

• $n =$ number of trials
• $p =$ probability of success
• $y =$ number of successes in $n$ Bernoulli trials

then
$P(Y = y) = \binom{n}{y}p^y(1-p)^{n-y}$

## Example

1. Let $Y \sim Bin(n = 5, p = 0.2)$ find the $E(Y)$ and $Var(Y)$
1. $E(Y) = np = 1$
2. $Var(Y) = np(1-p) = 0.8$
3. What is the probability that $y = 3$? In R: dbinom(size = 5, prob = 0.2, x = 3) $0.0512$
02:00

## Warnings

10% Condition: if trials are selected at random, it is OK to ignore dependence caused by sampling from a finite population if the selected trials make up less than 10% of the population

## Limit of $p$- mins

I know about 7 cars drive by my house in an hour, what’s the probability 18 cars drive by in the next 60 mins?

• $p = \frac{7}{60}$

• $Y \sim Bin(60, \frac{7}{60})$

• $\binom{60}{18}p^{18}(1-p)^{42}$

## Limit of $p$- secs

I know about 7 cars drive by my house in an hour, what’s the probability 18 cars drive by in the next 3600 secs?

• $p = \frac{7}{3600}$

• $Y \sim Bin(3600, \frac{7}{3600})$

• $\binom{3600}{18}p^{18}(1-p)^{3582}$

## Limit of $p$ - smallest interval

I know about 7 cars drive by my house in an hour, what’s the probability 18 cars drive by in the next much smaller than a second? Full derivation can be found here.

• $\binom{n}{18}(\frac{7}{n})^{18}(1-\frac{7}{n})^{n-18}$

• $\frac{n\cdot(n-1)\ldots(n-17)}{18!}\cdot \frac{7^{18}}{n^{18}}\cdot (1-\frac{7}{n})^{n} \cdot \frac{1}{(1-\frac{7}{n})^{18}}$

• $\frac{n\cdot(n-1)\ldots(n-17)}{n^{18}} \rightarrow 1$

• $\frac{1}{(1-\frac{7}{n})^{18}} \rightarrow 1$

$\frac{7^{18}}{18!}e^{-7}$

# Poisson distribution

If $X \sim Pois(\lambda)$ then $P(X=x) = \frac{\lambda^{x}}{x!}e^{-\lambda}$

## Poisson distribution - RIPS

• Poisson - fish - Rips
• R - randomly through space or time
• I - indepedent
• P - proportional to interval size
• S - singly - no multiple occurences in space or time

## E(Pois)

$\lambda$

## Var(Pois)

$\lambda$

## Example

1. Let $Y \sim Pois(\lambda = 5)$ find the $E(Y)$ and $Var(Y)$
1. $E(Y) = 5$
2. $Var(Y) = 5$
3. What is the probability that $y = 3$? In R: dpois(x = 3, lambda = 5) $0.1403739$
02:00