# Stat 202: Lecture 10 (covers pp. 124-137)

Nathan VanHoudnos
10/15/2014

### Agenda

2. Checkpoint #11 results
3. Lecture 10 (covers pp. 124-137)

mean(hw3.grades/85)

[1] 0.9068

median(hw3.grades/85)

[1] 0.9412


### Agenda

2. Checkpoint #11 results
3. Lecture 10 (covers pp. 124-137)

### Checkpoint #11 results

• 69/76 students
• on average 86% percent correct

### Checkpoint #11 Question 1

(i) 31% of all Dalmatians have blue eyes.
(ii) 38% of all Dalmatians are deaf.
(iii) 42% of blue-eyed Dalmatians are deaf.

What is the probability that a randomly chosen Dalmatian is blue-eyed and deaf?

$$P(B \text{ and } D) = ?$$

Must use the general multiplication rule:

$$P(B \text{ and } D) = P(D|B)P(B) = .42 * .31 = .13$$

Note that: $$P(D)P(B) = .38 * .31 = .118 \ne P(B \text{ and } D)$$

### Agenda

2. Checkpoint #11 results
3. Lecture 10 (covers pp. 124-137)
• Checkpoint 12: Random variables (RVs) and distributions
• Checkpoint 13: Expection and variance rules

### Random Variables

random variable: A random variable assigns a unique numerical value to the outcome of a random experiment.

Consider the random experiment of flipping a coin twice. $$S = \{ HH, HT, TH, TT \}$$

Let $$X$$ be the number of tails.

• HH implies $$X = 0$$
• HT implies $$X = 1$$
• TH implies $$X = 1$$
• TT implies $$X = 2$$

### Random Variables

Consider getting data from a random sample on the number of ears in which a person wears one or more earrings.

Let $$X$$ be the number of ears in which a randomly selected person wears an earring.

If the selected person

• does not wear any earrings, then $$X = 0$$.

• wears earrings in either the left or the right ear, then $$X = 1$$.

• wears earrings in both ears, then $$X = 2$$.

### Random Variables

Assume we choose a lightweight male boxer at random and record his exact weight. According to the boxing rules, a lightweight male boxer must weigh between 130 and 135 pounds, so the sample space here is $$S = [130, 135]$$.

Let $$X$$ be the weight of the boxer.

In this case, $$X \in [130,135]$$.

### Random Variables

random variable: A random variable assigns a unique numerical value to the outcome of a random experiment.

Always arise from a random experiment!

Two types of random variables:

• discrete : possible values are from a list

• “Things you count.”
• continuous : possible values are from an interval

• “Things you measure.” (w/ or w/o rounding)

### Random Variables

Number of ears pierced?

• discrete

Weight of a lightweight boxer?

• continuous

Number of hours watching TV (rounded to the nearest hour)?

• continuous (rounded is still continuous)

### Random Variables

How many days per week do you drink soda?

• discrete

How many ounces of soda per week do you drink?

• continuous

The average weight of 18 year old males at basic training.

• continuous

### Distribution of a discrete RV

Consider the random experiment of flipping a coin twice. $$S = \{ HH, HT, TH, TT \}$$

Let $$X$$ be the number of tails. Recall: \begin{aligned} HH \rightarrow X & = 0 & HT \rightarrow X & = 1 \\ TH \rightarrow X & = 1 & TT \rightarrow X & = 2 \end{aligned}

What is the probability of $$X=0$$?

$P( X = 0) = P( HH ) = \frac{1}{4}$

### Distribution of a discrete RV

Consider the random experiment of flipping a coin twice. $$S = \{ HH, HT, TH, TT \}$$

Let $$X$$ be the number of tails. Recall: \begin{aligned} HH \rightarrow X & = 0 & HT \rightarrow X & = 1 \\ TH \rightarrow X & = 1 & TT \rightarrow X & = 2 \end{aligned}

What is the probability of $$X=1$$? \begin{aligned} P( X = 1) & = P( HT \text{ or } TH ) \\ & = P( HT ) + P(TH ) \\ & = \frac{1}{4} + \frac{1}{4} = \frac{1}{2} \end{aligned}

### Distribution of a discrete RV

Consider the random experiment of flipping a coin twice. $$S = \{ HH, HT, TH, TT \}$$

Let $$X$$ be the number of tails. Recall: \begin{aligned} HH \rightarrow X & = 0 & HT \rightarrow X & = 1 \\ TH \rightarrow X & = 1 & TT \rightarrow X & = 2 \end{aligned}

The distribution of $$X$$:

x        |   0 |   1 |   2 |
---------+-----+-----+-----|
P(X = x) | 1/4 | 1/2 | 1/4 |


### Comment on notation

The distribution of $$X$$:

x        |   0 |   1 |   2 |
---------+-----+-----+-----|
P(X = x) | 1/4 | 1/2 | 1/4 |


$$P(X = x)$$ is read as

• the probability that
• the random variable $$X$$ is
• equal to the value $$x$$.

Random variables are CAPITALIZED.

Values (AKA realizations) are lower case.

### Reprise: Rules

Let $$X$$ be a random variable and $$x$$ a realization of that random variable.

1. $$0 \le P(X = x) \le 1$$ for all $$x$$.

For example:

x        |   0 |   1 |   2 |
---------+-----+-----+-----|
P(X = x) | 1/4 | 1/2 | 1/4 |


\begin{aligned} 0 & \le P(X = 0) = \frac{1}{4} \le 1 \\ 0 & \le P(X = 1) = \frac{1}{2} \le 1\\ \end{aligned}

### Reprise: Rules

Let $$X$$ be a random variable and $$x$$ a realization of that random variable.

1. $$0 \le P(X = x) \le 1$$ for all $$x$$.
2. $$\sum_{x\in S} P(X = x) = 1$$ $$\quad$$

For example:

\begin{aligned} \sum_{x \in S} P(X = x) & = P(X=0) + P(X=1) + P(X=2) \\ & = 1/4 + 1/2 + 1/4 = 1 \end{aligned}

Note: If summation notation is unfamiliar, check out Khan Academy here and here.

### A further example

A coin is tossed three times. Let the random variable X be the number of tails. Find the probability distribution of X.

1. Write out the sample space.
2. Define each possible realization of $$X$$ as an event.
3. Find the probabilities of the events.

### A further example

\begin{aligned} S = \{ & HHH, HHT, HTH, HTT, \\ & THH, THT, TTH, TTT \} \end{aligned}

\begin{aligned} X & = 0 \quad \{ HHH \} \\ X & = 1 \quad \{ HHT, HTH, THH \} \\ X & = 2 \quad \{ HTT, THT, TTH \} \\ X & = 3 \quad \{ TTT \} \end{aligned}

x        |   0 |   1 |   2 |   3 |
---------+-----+-----+-----+-----|
P(X = x) | 1/8 | 3/8 | 3/8 | 1/8 |


### Formulas to define discrete RVs

An example: $P(X = x) = \frac{x+2}{25} \quad \quad x \in \{1,2,3,4,5\}$

Check rule 1:

$0 \le P(X=x) \le 1 \quad \text{ for all } x$

Note that: \begin{aligned} P(X = 1) & < P(X =5) \\ 0 \le \frac{1 + 2}{25} & < \frac{5+2}{25} \le 1 \end{aligned}

### Formulas to define discrete RVs

An example: $P(X = x) = \frac{x+2}{25} \quad \quad x \in \{1,2,3,4,5\}$

Check rule 2:

\begin{aligned} \sum_{x\in S} P(X = x) & = \sum_{x\in S} \frac{x+2}{25} \\ & = \frac{1}{25} \sum_{x\in \{1,2,3,4,5\}} \left( x +2 \right) \\ & = \frac{1}{25} 25 = 1\end{aligned}

### Probability Histograms (p. 130)

$$P(X = x) = \frac{x+2}{25} \quad \quad x \in \{1,2,3,4,5\}$$

Distribution A

Distribution B

### Larger standard deviation?

Distribution A

• values are farther from the mean
• larger standard deviation

Distribution B