Discrete Random Variables

Discrete Random Variables

Random Variable: A real-valued function defined on the sample space.

Range of Random Variable, R(X): All possible values X can take on.

Discrete Random Variable: A random variable with finite or countable R(X)

Two Types of Numerical Variables:

  1. Discrete: Countable
  2. Continuous: Uncountable

Probability Mass Function: P_X (i) = P(X = i), where i \in R(X)

Example: Random variable

Suppose we want to define X to be the number of heads we get after flipping a coin three times.

Our sample space would be:

In our sample space, heads can be gotten between 0—3 times. By putting the count above n, we can define the probability mass function in a table like so:

iP(X=i)
01/8
13/8
23/8
31/8
Total1

For example to find P(at most one heads), or P(X \le 1):

\begin{aligned} P(X \le 1) &= P(X = 0) + P(X = 1) \\ &= \frac{1}{8} + \frac{3}{8} \\ &= \frac{1}{2} \end{aligned}
Example: Probability mass function

Q: Each of the following tables lists certain values of X and their probabilities P(x).

Determine whether each table represents a valid probability mass function.

iP(X=i)
30.5
50.2
70.4
iP(X=i)
00.3
10.9
2-0.2
iP(X=i)
20.2
30.6
60.1
90.1

A:

Remember: A valid probability mass function will have its probabilities add up to 1.0, and each individual probability must be a valid probability (between 0 and 1).

  1. No, probabilities add up to 1.1
  2. No, -0.2 is not a possible probability
  3. Yes, probabilities add up to 1.0 and all probabilities are valid.

Expectation of Random Variables; E(X) \lor \mu: Weighted average of a random variable’s outcomes.

\boxed{ E(X) = \sum_{i \in R(X)} i P(X=i) = \mu }

Example: Random variable

Q: Find the expectation of the random variable.

Ex: Flip a coin three times.

A:

\begin{aligned} E(X) &= \sum_{i \in \{ 0, 1, 2, 3 \}} i P(X=i) &= 0P(X=0) + 1P(X=1) + 2P(X=2) + 3P(X=3) &= 0 \times \frac{1}{8} + 1 \times \frac{3}{8} + 2 \times \frac{3}{8} + 3 \times \frac{1}{8} &= \frac{3}{2} \end{aligned}

iP(X=i)i P(X=i)
01/80 \times \frac{1}{8}
13/81 \times \frac{3}{8}
23/82 \times \frac{6}{8}
31/83 \times \frac{3}{8}
Total1E(X) = \mu = \frac{3}{2}

Variance of Random Variables:

\boxed{ Var(X) = E(X^2) - \mu^2 = \sigma^2 } \\~\\ \small\textit{where } E(X^2) = \sum_{i \in R(X)} i^2 P(X=i)

Example: Why?\begin{aligned} Var(X) &= E [ (X - \mu)^2 ] = \sum_{i \in R(X)} (i - \mu)^2 P(X-i) = \sigma^2 \\ &= E(X^2) - \mu^2 \quad \text{where } E(X^2) = \sum_{i \in R(X)} i^2 P(X=i) \end{aligned}

Binomial R.V. X~B(n,p)

Binomial Random Variable: X ~ B(n,p)

Assumptions:

\boxed{ \text{Binomial: } \begin{cases} R(x) &= \{ 0, 1, ..., n \} \\~\\ P(X=j) &= \binom{n}{j} p^j (1 - p)^{n-j} \\~\\ &\text{: Prob. of $j$ successes out of $n$ trials} \\~\\ E(X) &= np = \mu \\~\\ Var(X) &= \sqrt{np(1-p)} = \sigma \end{cases} }

Poisson R.V. X ~ Poi(\lambda)

Poisson Experiment: When we want to know the probability that a specific number of occurrences takes place within a given interval of time, length, or space (X).

Assumptions:

Poisson v.s. Binomial R.V.

Example: Binomial or Poisson?

Q: Collect a sample of 10 people in a hospital and examine whether each of them has lung cancer.

A: X = number of patient with cancer. Number of trials is fixed. Binomial.

Q: Go to a hospital and see how many lung cancer patients come a day.

A: X = number of patient with cancer / day. No finite number of trials. Poisson.

\lambda: \text{mean num. of occurrences during the given interval}

\boxed{ \text{Poisson: } \begin{cases} R(x) &= \{ 0, 1, 2, 3,4 , ... \} \\~\\ P(X=j) &= \frac{e^{-\lambda}\lambda^j}{j!} \\~\\ &\text{: Prob. of exactly $j$ occurrences in given interval} \\~\\ E(X) &= \lambda \\~\\ Var(X) &= \lambda \qquad (SD = \sqrt{\lambda}) \end{cases} }

Example: Poisson R.V.

Q: \lambda = 6, find P(X=4)

A: P(X=4) = \frac{e^{-6}6^4}{4!} = 0.1339

Q: \lambda = 6, find P(X \le 1)

A: P(X=0) = P(X=1) = 0.0025 + 0.0149 = 0.0174

Q: \lambda = 6, find P(X \ge 2)

A: P(X \ge 2) = 1 - P(X<2) = 0.9826


Given: A restaurant has on average 10 customers per day.

Q: What is the probability they have exactly 5 customers on a given day?

A:

Let X: the # of customers a day ~ Pois(10)

P(X=5) = \frac{e^{-10}10^5}{5!} = 0.0378

Q: What is the probability they have more than 3 customers on a given day?

A: P(X>3) = 1 - P(X \le 3) = 0.9896

Q: What is the expected number of customers for tomorrow?

A: E(X) = 10

Q: What is the standard deviation of the number of customers?

A: We know Var(X) = 10

So SD = \sqrt{10}

Geometric R.V. ~ G(p)

X: The # of independent trials until the first success occurs with probability of success p.

\boxed{ \text{Geometric: } \begin{cases} R(x) &= \{ 1, 2, 3, 4 , ... \} \\~\\ P(X=j) &= (1-p)^{j-1} p, \qquad 0 < p < 1 \\~\\ E(X) &= 1/p \\~\\ Var(X) &= (1-p)/p^2 \end{cases} }

Example: Geometric R.V.

Roll a die until you get a 4.

Let X: number of trials until 4 appears.

Then,

\begin{align*} R(x) &= {1,2,3,...} \\~\\ p &= 1/6 \\~\\ P(X=j) &= (1-p)^{j-1} p = \left \frac{5}{6} \right^{j-1} \frac{1}{6} \\~\\ E(X) &= 6 \\~\\ Var(X) &= 30 \end{align*}

Hypergeometric R.V ~ HG(N,m,n)

X: The number of objects with a specific trait out of a sample size n; where:

\boxed{ \text{Hypergeometric: } \begin{cases} R(x) &= \{ max(0,n+m-N), ..., min(m,n) \} \\~\\ P(X=j) &= \frac{\binom{m}{j} \binom{N-m}{n-j}}{\binom{N}{n}} \\~\\ E(X) &= \frac{nm}{N} \\~\\ Var(X) &= \frac{nm(N-n)(N-m)}{N^2(N-1)} \end{cases} }

Example: Hypergeometric R.V.

Q: There is an urn with 10 black balls and 6 white balls. 5 balls will be drawn in a row without replacement. Find the probability that two balls are white.

A:

Let X = Number of white balls

R(X) = \{ 0, 1, ..., 5 \}

\begin{align*} P(X=2) &= \frac{\binom{m}{j} \binom{N-m}{n-j}}{\binom{N}{n}} \\ &= \frac{\binom{6}{2} \binom{16-6}{5-2}}{\binom{16}{5}} \\ &= 0.4127 \end{align*}

E(X) = \frac{nm}{N} = \frac{5 \times 6}{16} = \frac{15}{8}