Docsity

Midterm 2 Review - Introductory Probability and Statistics | STAT 21, Exams of Statistics

Toggle sidebar
bg1
Stat 21 Midterm 2 Review
August 13, 2007
This handout is intended to be a comprehensive study guide for the first Stat 21 midterm exam. I have tried
to cover all the course material in a way that targets what you need to know to do well on the test. If you
understand everything in this handout, then you have a great shot at getting an A. Also, it’s a good idea
to put some time and effort into creating the page of notes you’re allowed to bring in. Do this as soon as
possible so that you can practice problems with your formula sheet. A good place to start in preparing your
notes is with the numbered formulas in this handout. Good luck on the exam!
1 Data Basics and Histograms
Many quantities in the world around us are random. When we want to study a particular population, we
are often interested in the distribution of values within that population. A good example of this is age. At
any given time, there is a certain proportion of children, teenagers, young adults, middle aged people, and
elderly people. Occasionally someone lives to be 110 and then we get to hear about it on the Today Show.
In order to determine how rare such an event is, we can represent a data set’s distribution visually using a
histogram. A histogram splits the population into a number of groups, much as I did for age ranges above,
and then provides a bar graph showing the size of the group. One way to do this is to just make the height of
the group equal to the number of people within it. However, when the groups have different widths, a better
way to compare groups is by drawing the histogram on the density scale. To convert data to the density
scale, divide the total population within a group by the range of the group. The main formulas you’ll need
are:
Density within class interval =Area in class interval
Length of class interval (1)
Percentage of Data within a class interval =Area of class interval
Total Area (2)
Teenagers are usually defined as people with age Xin [13,20). If there 7 million teenagers in the population,
then this group has a density of 1 million per year. We usually then go on to convert from absolute density
to relative density. If the overall population of the country is 100 million, then each one-year interval within
the teenager subgroup contains 1% of the overall population. By drawing the histogram according to this
density, we can immediately compare the size of subgroups according to which has the large volume, and we
can say that one subgroup is more crowded than the other if its height is higher.
Once we have a histogram on the density scale, we can define the qth percentile as the point xso that the
proportion of data points less than xis qpercent. For instance, in the above teenager example, suppose
that there are 3 million children with age Xin [0,13) and 7 million teenagers with age Xin [13,20). So a
total of 10 million people out of the population of 100 million are under the age of 20, which means that we
can conclude that the age of 20 years is the 10th percentile of age. Let’s also review some other histogram
examples:
Example of Histograms:
Age Total Population (Millions)
0-10 20
10-20 10
20-40 30
40-70 15
70-95 25
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Midterm 2 Review - Introductory Probability and Statistics | STAT 21 and more Exams Statistics in PDF only on Docsity!

Stat 21 Midterm 2 Review

August 13, 2007

This handout is intended to be a comprehensive study guide for the first Stat 21 midterm exam. I have tried to cover all the course material in a way that targets what you need to know to do well on the test. If you understand everything in this handout, then you have a great shot at getting an A. Also, it’s a good idea to put some time and effort into creating the page of notes you’re allowed to bring in. Do this as soon as possible so that you can practice problems with your formula sheet. A good place to start in preparing your notes is with the numbered formulas in this handout. Good luck on the exam!

1 Data Basics and Histograms

Many quantities in the world around us are random. When we want to study a particular population, we are often interested in the distribution of values within that population. A good example of this is age. At any given time, there is a certain proportion of children, teenagers, young adults, middle aged people, and elderly people. Occasionally someone lives to be 110 and then we get to hear about it on the Today Show. In order to determine how rare such an event is, we can represent a data set’s distribution visually using a histogram. A histogram splits the population into a number of groups, much as I did for age ranges above, and then provides a bar graph showing the size of the group. One way to do this is to just make the height of the group equal to the number of people within it. However, when the groups have different widths, a better way to compare groups is by drawing the histogram on the density scale. To convert data to the density scale, divide the total population within a group by the range of the group. The main formulas you’ll need are:

Density within class interval =

Area in class interval Length of class interval

Percentage of Data within a class interval =

Area of class interval Total Area

Teenagers are usually defined as people with age X in [13, 20). If there 7 million teenagers in the population, then this group has a density of 1 million per year. We usually then go on to convert from absolute density to relative density. If the overall population of the country is 100 million, then each one-year interval within the teenager subgroup contains 1% of the overall population. By drawing the histogram according to this density, we can immediately compare the size of subgroups according to which has the large volume, and we can say that one subgroup is more crowded than the other if its height is higher.

Once we have a histogram on the density scale, we can define the qth percentile as the point x so that the proportion of data points less than x is q percent. For instance, in the above teenager example, suppose that there are 3 million children with age X in [0, 13) and 7 million teenagers with age X in [13, 20). So a total of 10 million people out of the population of 100 million are under the age of 20, which means that we can conclude that the age of 20 years is the 10th percentile of age. Let’s also review some other histogram examples:

Example of Histograms:

Age Total Population (Millions) 0-10 20 10-20 10 20-40 30 40-70 15 70-95 25

Figure 1: Density Scale Histogram for Population in Statististakia

The above table depicts the age distribution for the population inhabiting the island of Statististakia. Each group includes the left end-point but not the right. (So, for instance, the first group includes people between the age of 0 and 1, but does not include anyone 10 or older.)

Draw a histogram on the density scale of the age distribution in Statististakia. Don’t forget to label its axes!

Please see Figure 1 for the solution.

We can then go on to count proportions within various subgroups. For examples, let’s consider the above population data to solve the following problems:

Example: Histogram Group Comparisons. Would you estimate that there are more 2 year olds (people with age 2 ≤ age < 3) than 71 year olds (people with age 71 ≤ age < 72) on the island of Statististakia?

Estimated number of 2 year olds: 10 20%− 0 = 2%

Estimated number of 71 year olds: 95 25%− 70 = 1%.

We estimate that there are more 2 year olds than 71 year olds in Statististakia. These estimates assume that the population within each age group in the table is evenly distributed. In reality, the number of 2 year olds and 71 year olds may be somewhat more or less than the estimated percentages.

The Statististakians want to pair young people between the ages of 12 and 15 (excluding the right endpoint, so 12 ≤ age < 15) with middle-aged people between the ages of 42 and 46 (excluding the right endpoint, so 42 ≤ age < 46) for a mentoring program. About what percentage of people in Statististakia are eligible to participate?

People 12-15: (15 20 −12)10%− 10 = 3 ∗ 10 10% = 3%.

People 42-46: (46 70 −42)15%− 40 = 4 ∗ 30 15% = 2%

The estimated percentage of the population that is eligible for the program is 3% + 2% = 5%.

Having done this, we must then recognize that 20% of the total cars are driving less than 10 mph, and a total of 20% + 50% = 70% of the total cars are driving less than 40 mph. We define the 55th percentile as the speed at which 55% of all cars are driving less than that speed. Because speed is a con- tinuous variable, we can estimate percentiles on the histogram by assuming that the data are evenly distributed within each class interval. We have determined that the 20th percentile is 10 mph, and also that the 70th percentile is 40 mph. Therefore, the 55th percentile lies between these values. Starting from the left, we can say that we require 35% of area to come from the interval [10, x). We can solve for x as follows:

x = 35%50% (40mph − 10 mph) = 21mph.

This is the number of mph over 10, so the 55th percentile is 10 + x = 10mph + 21mph = 31mph.

2 Means, Standard Deviations, and Standard Units

2.1 Definitions

Suppose you have data X 1 ,... , Xn. We can define the mean, median, standard deviation, and standard units measures as follows:

Mean: X¯ =

n

∑^ n

i=

Xi =

n

(X 1 + X 2 +... + Xn) (3)

For the median, we must further suppose that the data X 1 ,... , Xn are sorted in increasing or decreasing order.

Median: Med(X) =

X n+ 2 if n is odd, OR

1 2

X n 2 + X n 2 +

if n is even.

St. Dev: SD(X) =

n

∑^ n

i=

(Xi − X¯)^2 =

[

n

∑^ n

i=

X i^2

]

− ( X¯)^2 (5)

For the Standard deviation, the first equation is the definition, and the second equation is a computing formula that can sometimes be easier to use. Either equation is fine to use, and we proved in class that they are equivalent. Note that the standard deviation is never negative; we’re taking the positive square root. Also remember that a standard deviation of zero means that your data is constant (i.e. not random).

St. Units: SU (Xi) = Xi − X¯ SD(X)

Let’s run through a quick example. Suppose you have data (X 1 , X 2 , X 3 , X 4 , X 5 ) = (13, 15 , 16 , 17 , 19). We have n = 5 data points. Then

X¯ = 1 n

∑n i=1 Xi^ =^

1 5 (13 + 15 + 16 + 17 + 19) =^

80 5 = 16.

Med(X) = X n+1 2 = X 5+1 2 = X 3 = 16.

SD(X) =

1 n

∑n i=1(Xi^ −^ X¯)

1 5 [(13^ −^ 16)

2 + (15 − 16) 2 + (16 − 16) 2 + (17 − 16) 2 + (19 − 16) 2 ]

1 5 (9 + 1 + 0 + 1 + 9) =

20 5 =^

SU (X 1 ) = X^1 −^

X¯ SD(X) =^

13 − 16 2 =^ −^1 .5.^ Likewise, you can verify that^ SU^ (X^2 ) =^ −^0 .5,^ SU^ (X^3 ) = 0, SU (X 4 ) = 0.5, and SU (X 5 ) = 1.5.

We like to use standard units for two reasons: first, it immediately tells us how many standard deviations from the mean a data point is, and second, it is a first step in using the Normal Distribution to estimate percentiles.

2.2 Linear Transformations of Data

Suppose we have data (X 1 ,... , Xn), and we’re actually interested in a linear function of this data. A linear function always has the form Yi = aXi + b, where a and b are fixed real numbers. Then, if we know X¯ and SD(X), we can quickly compute Y¯ and SD(Y ) by the following formulas:

Y¯ = a X¯ + b if Yi = aXi + b for 1 ≤ i ≤ n (7)

SD(Y ) = |a|SD(X) if Yi = aXi + b for 1 ≤ i ≤ n (8)

I’m going to provide a quick proof of these equations. We only expect you to be able to use them when it’s appropriate, but going through the proofs provide good examples of means and standard deviations and might help you understand what’s going on. It’s OK if you just want to skip to the example.

Proof of Equation 7:

Y^ ¯ = (^) n^1 ∑ni=1 Yi = (^) n^1 ∑ni=1 [aXi + b] = (^1) n [(∑ni=1 aXi) + ∑ni=1 b] = (^1) n [(a ∑ni=1 Xi) + nb]

= a (^1) n

∑n i=1 Xi^ +^

1 n (nb) =^ a^ X¯i + b.

Proof of Equation 8:

SD(Y ) =

1 n

∑n i=1(Yi^ −^ Y¯^ )

1 n

∑n i=

[aXi + b] −

[

a X¯ + b

]) 2

1 n

∑n i=

aXi − a X¯ + b − b

1 n

∑n i=

a

[

Xi − X¯

]) 2

1 n

∑n i=1 a 2 (Xi − X¯)^2 =

a2 1 n

∑n i=

Xi − X¯

= |a|

1 n

∑n i=

Xi − X¯

= |a|SD(X). Notice that this result does not depend on b. This means that adding a constant to every data point will not affect the standard deviation.

Example of Linear Transformations: You collect data on children’s height at age 10 and find that the average height is X¯ = 40 inches with a standard deviation of SD(X) = 4 inches. However, the doctor you’re working for has two complaints with the data: first of all, he wanted the data in centimeters, and secondly, the measuring stick was found to be two inches shorter than it’s supposed to be. Provide the mean and SD of the children’s heights in centimeters.

To solve this problem, we first need to create a linear transformation of the data that accounts for the doctor’s complaints. Remember that 1 inch = 2.54 centimeters, and we need to add one inch to each child’s height. Therefore, we have the equation:

Yi = 2.54(Xi + 2) = 2. 54 Xi + 5.08. So a = 2.54 and b = 5.08. Then

Y¯ = a X¯ + b = 2.54(40) + 5.08 = 106.68 centimeters.

SD(Y ) = |a|SD(X) = 2.54(4) = 10.16 centimeters.

Standard Units as a Linear Transformation: You collect data X 1 ,... , Xn, and calculate X¯ and SD(X). What are the mean and standard deviation of the data in standard units?

We convert to standard units via the formula Y = SU (X) = Xi−^ X¯ SD(X) =^

Xi SD(X) −^

X¯ SD(X). We have^ a^ =^

1 SD(X) and b = (^) SD−^ X(¯X).

Y¯ = a X¯ + b =

[

1 SD(X)

]

X¯ − X¯

SD(X) =^

X¯− X¯ SD(X) = 0.

SD(Y ) = |a|SD(X) = | (^) SD^1 (X) |SD(X) = 1. Remember that the standard deviation is never negative, so the absolute value goes away.

and standard deviation 15. What proportion of people have an IQ of 130 or higher?

Let’s convert the data to standard units. We are interested in how many people score higher than X = 130, and in standard units, this is given by z = X−^ X¯ SD(X) =^

130 − 100 15 = 2. So, in the Standard Normal distribution, we want to find the area under the curve in the region C with z = 2. If we refer to the chart in the back of the book, we find that the area in region B for z = 2 is about 0.9545, so we need to apply Equation 9 to find C:

1 = A + B + C = B + 2C ⇒ C = 1 − 2 B = 1 −^0. 29545 = 0.02275.

So about 2.275% of the population has an IQ of 130 or greater.

4 Correlation and Regression

We are often interested to find out whether there is a relationship between variables X and Y. Suppose you have data (X 1 , Y 1 ),... , (Xn, Yn). The correlation is a measure of association that indicates the strength and direction of a linear relationship. We can define the correlation as:

r =

n

∑^ n

i=

(Xi − X¯)(Yi − Y¯ ) SD(X)SD(Y )

n

∑^ n

i=

SU (Xi)SU (Yi) (10)

The correlation is always in the interval − 1 ≤ r ≤ 1. When r is positive, an increase in X corresponds to an increase in Y (and likewise an increase in Y leads to an increase in X). When r is negative, an increase in X leads to a decrease in Y (and vice-versa). When r = 0, then increasing X has no effect on Y. However, because X and Y are random, the value of Y for a specific value of X has a distribution of values it can take. This is true except when r = 1 or r = −1, in which case Y is a linear function of X and so knowing one means you can predict the other exactly.

Example of Correlation: You have data (X 1 ,... , X 5 ) = (1, 3 , 4 , 5 , 7) and (Y 1 ,... , Y 5 ) = (11, 9 , 13 , 10 , 7). X¯ = 4, Y¯ = 10, and SD(X) = SD(Y ) = 2. Find the Correlation of X and Y.

Let’s convert the data into Standard Units. Apply the formula SU (Xi) = Xi−^ X¯ SD(X) to get [SU^ (X^1 ),... , SU^ (X^5 )] = (− 1. 5 , − 0. 5 , 0 , 0. 5 , 1 .5), and likewise [SU (Y 1 ),... , SU (Y 5 )] = (0. 5 , − 0. 5 , 1. 5 , 0 , − 1 .5). Then

r = (^) n^1

∑n i=1 SU^ (Xi)SU^ (Yi) =^

1 5 (−^1 .5(0.5)^ −^0 .5(−^0 .5) + 0(1) + 0.5(0) + 1.5(−^1 .5)) =^

− 2. 75 5 =^ −^0 .55.

One of the most important lessons you should take away from this class is that correlation doesn’t imply causation.

Now we have all the tools we need to turn our attention to prediction, the holy grail of statistics. Prediction is important because it helps us make decisions. In an uncertain world, we have to make decisions based upon the information available to us in a manner that best achieves our goals. When universities decide which applicants to admit, they have to decide what qualities are important and then predict the student’s perfor- mance in college based upon the information available. One way we can do that is using a regression estimate.

In a regression setting, we collect data X 1 ,... , Xn and Y 1 ,... , Yn, where each pair of points (Xi, Yi) are collected from the same observation. For instance, we might collect SAT scores and first year college GPAs for n university students. Then, using this data, we want to make a general prediction about the population we’re studying. There isn’t much point in predicting the GPA of the students we collected data on because they’ve already completed their first year. However, the information we get from them can be used to predict first year GPA for the next year’s applicants. To do this, we’ll construct the regression line:

Y = Y¯ + r

SD(Y )

SD(X)

(X − X¯) (11)

The regression line tells us an average value of Y given a value of X. Of course, since this is a prediction, we don’t know what someone’s first year GPA will be just from finding out their SAT score. The GPA follows a distribution centered around the predicted value. Let’s work an example:

Example: Regression. In a population study of middle-aged men, the average body weight is 180 pounds with a standard deviation of 20, and the average blood pressure is 100 with a standard deviation of 10. The study found a correlation of -0.6 between weight and blood pressure in this population. Suppose a particular middle aged man weighs 200 pounds. Predict his blood pressure.

We are trying to predict blood pressure Y based upon body weight X. We have Y¯ = 100, X¯ = 180, SD(Y ) = 10, SD(X) = 20, and r = − 0 .6. Plugging in Equation 11, we predict that a 200 pound middle- aged man will have the following blood pressure:

Y = Y¯ + r SD SD((XY^ )) (X − X¯) = 100 − 0 .6( 1020 )(200 − 180) = 94.

The regression line tells us an average value for Y given a value of X, but we are also interested in the standard deviation of the values Y can take given the value X. This standard deviation is given by the root mean squared error, or RMS error, which is defined as

RMS error = SD(Y |X) =

1 − r^2 SD(Y ) (12)

Example: RMS error. Referring to the Regression example above, what is the RMS error for the blood pressure of middle aged men who weigh 200 pounds?

Recall that r = − 0 .6 and SD(Y ) = 10. Then the RMS error is given by:

RM S = SD(Y |X = 200) =

1 − r^2 SD(Y ) =

Notice that the RMS error is different than the overall standard deviation for blood pressure SD(Y ). We’re often interested in predicting a range of values that covers a certain proportion of all possibilities for the person – it’s nice to be able to say that there’s a 95% chance that your blood pressure will be in a particular range. Since − 1 ≤ r ≤ 1, then 0 ≤

1 − r^2 ≤ 1, and therefore the RMS error is always within the range 0 ≤

1 − r^2 SD(Y ) ≤ SD(Y ). Since the RMS is never greater than SD(Y ), we can obtain a smaller interval using the RMS error. That’s the advantage of using regression.

So now we want to determine proportions of data falling into a specific range. Remember that the regression line gives us the mean value of Y for a particular value of X, and the RMS error gives us the standard deviation for Y values at that value of X. When the scatter plot of the data is ”football shaped”, we can assume that different measurements of Y for a particular value of X will follow a normal distribution with that mean and standard deviation. Then we can construct intervals containing the desired proportion of data points using the Normal area table in the back of your book.

One of the most important questions to ask yourself in answering regression problems is whether we’re talking about an overall population or some sub-population. You can usually determine this from the wording of the question: if we’re talking only about values of Y for a specific value of X, then we’re using a sub-population. We will refer to this population as Y |X, which you should think of in words as Y given X because you know specific information about the value of X. When this is not the case, it’s safe to use the entire population. Once you know which population you’re interested in for the problem at hand, you can refer to the chart below to obtain this population’s mean and standard deviation. For the conditional populations Y |X and X|Y , we use a point on the regression line as our estimate of the mean and the RMS error as our estimate of the standard deviation.

Population Mean Standard Deviation X X¯ SD(X) Y Y¯ SD(Y ) Y |X Y¯ + r SD SD((YX^ )) (X − X¯)

1 − r^2 [SD(Y )] X|Y X¯ + r SD SD((XY )) (Y − Y¯ )

1 − r^2 [SD(X)]

Example: Regression Prediction Intervals. Let’s continue with the example used in the Regression and RMS Error examples. The scatter plot was found to be football shaped. What proportion of 200 pound middle aged men will have a blood pressure between 86 and 102?

In the Regression Example, we found that the average blood pressure for 200 pound middle aged men is 94, and in the RMS Error example, we found that the standard deviation for the blood pressure readings of 200

5 Probability

We can say that a variable X is random if its value is uncertain. In many experimental situations, we can quantify this uncertainty in a precise way with a little notation. Define X’s state space S as a set of outcomes that can result for X in the experiment. When we roll a die, it can result in a value of 1-6, so our state space is S = { 1 , 2 , 3 , 4 , 5 , 6 }. Building upon this concept, we can define an event as any subset of the state space. For the die, we can define event A as any result that is less than 3. Then A is given by { 1 , 2 }. The complement of an event is given by the set of values in S that are not in the event. For A = { 1 , 2 }, we have its complement given by Ac^ = { 3 , 4 , 5 , 6 }. Events are mutually exclusive if they can not both occur at the same time. If we let B = { 3 , 4 }, then A and B are mutually exclusive because no roll of the die will result in an outcome that is part of both A and B. By definition, an event and its complement are mutually exclusive.

We can define the probability of an event to be the long-run proportion of outcomes that result in the event. Suppose we perform n identical experiments. Then the probability of event A is P (A) = (^1) n ∗ the number of experiments resulting in A as n tends toward infinity (i.e., we need to take a limit). The probability of any event is always in [0,1]. If an event has probability zero, it is certain that the event will not occur. If it has probability 1, it is certain that it will. Also, the probability of the state space is P (S) = 1. This means that any time you perform the experiment, it is certain that one of the outcomes in the state space will occur. So, imagine we flip a coin. Its state space is S = {H, T } – either heads or tails are valid outcomes, and every experiment results in an outcome in the sample space.

Example: Rolling a Fair Die. Suppose you roll a fair die. What is the probability that its result is less than 5?

Unless we say otherwise, a die always has 6 faces numbered 1-6. Let X be the result of the roll. Then the probability that X takes the value 1 is stated as P (X = 1). A fair die means that all possibilities are equally likely, so P (X = 1) = P (X = 2) = P (X = 3) = P (X = 4) = P (X = 5) = P (X = 6) = 16. We are interested in outcomes less than 5, so define event A to be all possible results less than 5: A = { 1 , 2 , 3 , 4 }. Then P (A) = P (X < 5) = 4/6.

5.1 Laws of Probability

Let’s quickly run through the laws of probability that we’ve studied and try to run through examples of each:

Intersections: P (A ∩ B) is the probability that both A and B occur simultaneously. The key word here is AND because both events have to happen.

Example of Intersections: You roll a fair die. What is the probability that its result is an even number less than 6?

Let A be the event that the result is an even number. We write A = { 2 , 4 , 6 }. Let B be the event that the result is less than 6 – this is B = { 1 , 2 , 3 , 4 , 5 }. An event is both even and less than 6 if it is an element of both A and B. The intersection is A ∩ B = { 2 , 4 }, the only results that are part of both A and B. Because the die is fair, all results are equally likely, so the probability of getting one of the two outcomes that are both even and less than 6 is P (A ∩ B) = 2/6.

Unions: P (A ∪ B) is the probability that the result is an element of A or of B. The key word here is OR, which means that one of the two must happen. (It’s also satisfied if both happen.)

Example of Unions: You roll a fair die. What is the probability that the result is an even number or that it is greater than 4?

Let A be the event that the result is an even number. We write A = { 2 , 4 , 6 }. Let B be the event that the result is greater than 4; this is B = { 5 , 6 }. Then any result that is an element of A or of B counts. We can describe this set as the union A ∪ B = { 2 , 4 , 5 , 6 }. Notice that the union is a set containing all elements contained in A or B, and we only list each element once, so the 6 doesn’t occur twice. Because the die is fair, all results are equally likely, so the probability of getting an outcome that is even or greater than 4 is P (A ∪ B) = 4/6.

Figure 5: Venn Diagram for Inclusion-Exclusion Rule 13

Inclusion-Exclusion Rule: For any events A and B, the probability of their union is given by:

P (A ∪ B) = P (A) + P (B) − P (A ∩ B). (13)

To see why this is true, look at Figure 5. I’ve divided set A into mutually exclusive sets X and Y so that A = X ∪ Y. Likewise, B is divided into sets Y and Z so that B = Y ∪ Z. Y is the intersection of A and B, so P (A ∩ B) = P (Y ). Because they’re mutually exclusive, we have P (A) = P (X) + P (Y ), and P (B) = P (Y ) + P (Z). However, if we take the union of A and B, we get A ∪ B = X ∪ Y ∪ Z. Notice that we can’t count region Y twice. Then P (A ∪ B) = P (X) + P (Y ) + P (Z) = [P (X) + P (Y )] + [P (Y ) + P (Z)] − P (Y ) = [P (A)] + [P (B)] − P (A ∩ B).

Example of Inclusion-Exclusion Rule: You roll a fair die. What is the probability that the result is an even number or that it is greater than 4?

Note that we already solved this problem in the Example of Unions. Let A = { 2 , 4 , 6 } and B = { 5 , 6 }, repre- senting the even outcomes and the outcomes greater than 4, respectively. Because the die is fair, all outcomes are equally likely, so P (A) = 3/6 and P (B) = 2/6. Both events occur when X = 6, so P (A ∩ B) = 1/6. Then

P (A ∪ B) = P (A) + P (B) − P (A ∩ B) = 3/6 + 2/ 6 − 1 /6 = 4/6.

It is tempting to use the Inclusion-Exclusion Rule for unions only when the events are not mutually exclusive. However, this rule applies to ANY union, and then you don’t have to remember a separate rule for mutually exclusive sets. When A and B are mutually exclusive, P (A∩B) = 0, and so then you just sum the probability of the individual events.

Conditional Probability: When we answer a question about probability, it is only valid within the partic- ular context of the question. There is, fundamentally, an experiment occurring with a random outcome, and the probability of a particular outcome depends upon the information given to us. The ”probability of an ace” is 1/6 when we’re talking about rolling a fair die, but it is only 1/13 when we’re talking about drawing a card from a fair deck. Because probabilities depend on the information given to us, it seems reasonable to conclude that knowing more information might change the answer. This is where the concept of conditional probability comes from. Within an experiment, we want to determine the probability of a particular event now that we know another event has occurred. This happens all the time in real life – we ask how likely it is that a team will win now that a star player is injured, or whether you’ll be late for work now that you’re stuck in traffic. For events A and B, we can write the conditional probability of A given that B has occurred as P (A|B). We can calculate conditional probabilities as follows:

P (A|B) =

P (A ∩ B)

P (B)

Example of Conditional Probability: You win a prize if a fair die results in an even number. You are told that the result was greater than 3. How likely are you to win the prize now that you know this information?

Let A be the even results { 2 , 4 , 6 } and B be the event that the result was greater than 3. We are inter- ested in P (A|B), the probability of getting an even number given that the result is greater than 3. Since B = { 4 , 5 , 6 }, we have P (B) = 3/6. Then A ∩ B = { 4 , 6 }, so P (A ∩ B) = 2/6. Using the definition of Conditional Probability, we have:

P (A)P (B|A) = P (B)P (A|B) (17)

Example of Baye’s Rule: Let’s consider the Example for the Law of Total Probability. You flip a fair coin. If the result is heads, you draw a marble from a bag containing 8 red and 2 green marbles. If the coin toss is tails, you draw a marble from a separate bag containing 4 red and 6 green marbles. You per- form the experiment and tell me you drew a green marble. What is the probability that the coin landed heads?

We are interested in P (B|A), the probability that the coin landed heads given that you drew a green marble. In the Law of Total Probability Example, we determined that the probability of drawing a green marble is P (A) = 0.4. The probability of getting heads is still P (B) = 0.5, and the probability of getting a green marble given heads is still P (A|B) = 2/10. Applying Baye’s Rule, we have

P (B|A) = P^ (A P|B (A)P)^ (B)= 0 .2(0 0. 4. 5)= 0.25.

Independence: We introduced Conditional Probability by stating that knowing more information can change the probability that an event will occur. However, not all information is useful. We say that events A and B are independent if knowing one does not change the probability of the other. That is,

P (A|B) = P (A) if A and B are independent. (18)

Likewise, P (B) = P (B|A) if A and B are independent. When we computed joint probabilities in Equation 15, we said we could always write P (A ∩ B) = P (B)P (A|B). But if A and B are independent, then the conditional probability P (A|B) is the same as the unconditional probability P (A), so we can then write the joint probability as

P (A ∩ B) = P (A)P (B) if A and B are independent. (19)

Example of Independence: I roll a fair die and tell you the result is less than 5. Knowing this information, what is the probability of getting an even number?

Let A be the event that you get an even number on the roll (without any information about its value). Then P (A) = 3/6 = 1/2 because you can get a 2, 4, or 6, and all results are equally likely. Let B be the event that the result is less than 5. Then the remaining values are { 1 , 2 , 3 , 4 }, and half of them are even numbers, so P (A|B) = 1/2 = P (A). Therefore, knowing that B occurred does not affect the probability of A, so A and B are independent.

Now let’s look at the probability that both A and B occur. We know that P (B) = 4/6 = 2/3, and condi- tioning upon this, the probability that both A and B occur is:

P (A ∩ B) = P (B)P (A|B) = 23 ( 12 ) = 13. Likewise, P (A)P (B) = 23 ( 12 ) = 13.

Law of the Complement: By definition, the complement of an event A is the event Ac, the set of all outcomes in S that are not in A. A and Ac^ are mutually exclusive, so A ∩ Ac^ = {} (the empty set), and every event in S is in either A or Ac. Therefore, we have A ∪ Ac^ = S, and so P (A ∪ Ac) = P (S) = 1. Since these events are mutually exclusive, we can say P (A) + P (Ac) = 1. The more familiar way to write this is the Law of the Complement:

P (A) = 1 − P (Ac) (20)

Example of the Law of the Complement: You roll two fair dice. What is the probability that their sum is less than 11?

Let X be the sum of the two dice. Then we could write P (X < 11) =

∑^10

i=

P (X = i). But that would be a

lot of work to calculate everything. So instead we write

P (X < 11) = 1 − P (X ≥ 11) = 1 − P (X = 11) − P (X = 12).

There are two ways to get a sum of 11: (5, 6) and (6, 5), and one way to get a sum of 12: (6, 6). So there are 3 outcomes that lead to a sum of 11 or greater out of a total of 36 equally likely possibilities, so we have

P (X < 11) = 1 − P (X = 11) − P (X = 12) = 1 − 2 / 36 − 1 /36 = 33/36 = 11/12.

5.2 Chebyshev’s Inequality

Sometimes it’s nice to have a baseline figure for what proportion of your data falls in a particular range. When the data follows a Normal distribution, we can use area charts to quantify these proportions with great precision. However, when data isn’t necessarily Normal, we can still use the Chebyshev inequality to get bounds on the minimum and maximum proportions of data falling within specific ranges.

Chebyshev’s Inequality: Suppose you have data X. We are interested in the proportion of data points within k standard deviations of the mean. Chebyshev’s Inequality says:

P (E[X] − kSD(X) < X < E[X] + kSD(X)) ≥ 1 −

k^2

Example of Chebyshev’s Inequality: Suppose the SAT math test has a mean score of X¯ = 500 and a standard deviation of SD(X) = 100. What proportion of students score between 350 and 650?

Students scoring 350 and 650 are k = 1.5 standard deviations away from the mean. To see this, you can convert these values to standard units: k = 650100 −^500 = 1.5. Chevyshev’s Inequality says the proportion of students scoring between 1.5 SD’s below and above the mean is:

P (350 < X < 650) ≥ 1 − (^) k^12 = 1 − (^1).^152 = 59.

5.3 Independent Data and With Replacement Sampling

Whenever we compute the probability of an intersection, we always factor the joint probability into a product of conditional probabilities as in Equation 15. When all the events in question are independent, it allows us to focus on the separate probability of each particular event, and then all we have to do is multiply them together to get the answer. The most common experiment involving independent events is with replacement sampling. For instance, let’s pretend you’ve entered a raffle in which 3 tickets will be drawn with replacement. Although you have only one ticket in the box, you could win all three prizes because the winning ticket of the previous draw is replaced in the box before the next winner is chosen. Whenever you see that a problem involves with replacement sampling, you should immediately think of independence. Then, think about each distinct event that happens, compute its probability, and multiply these probabilities together to get the joint probability. Let’s work an example:

Example: With Replacement. A raffle is held to give away three prizes. 5 out of a total of 20 tickets in the box have your name on it, and tickets are drawn with replacement to give away the prizes. What is the probability that you win the first and the third prize, but don’t win the second?

Because the raffle tickets are drawn with replacement, you have a 5/20 = 1/4 chance of winning on each draw. However, the question asks the probability that you’ll win the first and third but lose the second draw- ing. Let Yi take the value 1 if you win the ith drawing, and 0 if you lose. Then the event we are interested in is:

P (Y 1 = 1 ∩ Y 2 = 0 ∩ Y 3 = 1) = P (Y 1 = 1)P (Y 2 = 0|Y 1 = 1)P (Y 3 = 1|Y 1 = 1, Y 2 = 0) = P (Y 1 = 1)P (Y 2 = 0)P (Y 3 = 1) = (1/4)(1 − 1 /4)(1/4) = 3/64.

The second equality follows from the independence of the events due to with replacement sampling.

5.4 The Binomial Distribution

Many situations in life can be translated to a series of coin flips. Suppose you flip a coin n times, the coin has probability p of landing heads, and you want to know the probability of getting exactly k heads. Define

table tries to summarize some of this information:

Keyword Gut Reaction Rule to Try And Multiply Joint Probability Or Add Inclusion-Exclusion At least, most Phrase as an Inequality Law of the Complement With Replacement Independence Joint Probability Without Replacement Think Sequentially Joint Probability

6 Some Problems

Normal Curve Area: What is the area under the normal curve between -1 and 2?

Take a look at figure 2. The chart in the back of your book only provides areas for symmetric regions B between the values of −z and z, where z is some positive number. However, we can solve this problem by doing two different calculations. First, let’s find the area between −z = −2 and z = 2. Using the table, this is 95.45%. Then, let’s find the area between −s = −1 and s = 1. This is 68.27%. So the question is how to find the area between -2 and -1. For this, we use the symmetry of the Normal curve. Basically, there is (95. 45 − 68 .27)% = 27.18% that is between -2 and 2 but not between -1 and 1. Since the area in [− 2 , −1] is the same as the area in [1, 2], then we divide this difference by 2 to find the area in [− 2 , −1]. This gives us 27 .18%/2 = 13.59% between −2 and −1. Therefore, the area between −1 and 2 is:

95 .45% − 13 .59% = 81.86%

Without Replacement OR: You are dealt the first and third cards from a a fair deck. What is the prob- ability that you receive a queen?

This is a tricky problem because usually any question involving the words without replacement involves computing a joint probability, but since we also have the keyword or, we have to think in terms of unions.

Let Y 1 = 1 if the first card is a queen, and zero if it isn’t. Likewise, let Y 3 = 1 if the third card is a queen, and it is zero otherwise. If we don’t look at the other card, then P (Y 1 = 1) = P (Y 3 = 1) = 1/13. We are interested in P (Y 1 = 1 ∪ Y 3 = 1. Let’s apply the inclusion-exclusion rule:

P (Y 1 = 1 ∪ Y 3 = 1) = P (Y 1 = 1) + P (Y 3 = 1) − P (Y 1 = 1 ∩ Y 3 = 1)

If the first card is a queen, then Y 1 = 1 and P (Y 3 = 1|Y 1 = 1) = 3/51, since there are 3 queens remaining. Therefore, P (Y 1 = 1 ∩ Y 3 = 1) = P (Y 1 = 1)P (Y 3 = 1|Y 1 = 1) = 131 ( 513 ) = 6633. Now we can plug this back into the inclusion-exclusion rule:

P (Y 1 = 1 ∪ Y 3 = 1) = P (Y 1 = 1) + P (Y 3 = 1) − P (Y 1 = 1 ∩ Y 3 = 1)

= 1/13 + 1/ 13 − 3 /663 = 0. 149

Example: Without Replacement AND. You are dealt two cards from a fair deck. What is the proba- bility that the first is a diamond and the third is a club?

Let Y 1 be 1 if the first card is a diamond and zero otherwise. Let Y 2 be 1 if the second card is a club and zero otherwise. Because of the word and in the question, we are interested in a joint probability: P (Y 1 = 1 ∩ Y 2 = 1) = P (Y 1 = 1)P (Y 2 = 1|Y 1 = 1) = 13521351.

The conditional probability of getting a club in the second card given that we got a diamond in the first is 13/51 because there are still 13 clubs remaining but only 51 cards left in the deck after the first card (a diamond) is dealt.

You have a weighted coin that comes up heads 60% of the time. You toss it 10 times. What is the probability that you get 4 heads in the first 5 tosses and 2 heads in the last 5?

We can think of the number of heads in the first 5 tosses as a binomial random variable X with n = 5 and p = 0.6. Likewise, we can think of the number of heads in the last 5 tosses as a binomial random variable Y

with n = 5 and p = 0.6. X and Y are independent because they involve separate coin tosses. Let kX = 4 and kY = 2. Because of the word and in the question, we are interested in a joint probability:

P (X = 4 ∩ Y = 2) = P (X = 4)P (Y = 2|X = 4) = P (X = 4)P (Y = 2)

=

[

n! kX !(n−kX )! p

kX (^) (1 − p)n−kX

] [

n! kY !(n−kY )! p

kY (^) (1 − p)n−kY

]

[

5! 4!(5−4)! 0.^6

] [

5! 2!(5−2)! 0.^6

]

Example: At least j heads. You flip a fair coin 5 times. What is the probability of getting at least 4 heads?

Let X be the number of heads in n = 5 tosses of a fair coin with p = 0.5. We get an outcome we want if X = 4 or X = 5. Because of the word or here, we have a union:

P (X = 4 ∪ X = 5) = P (X = 4) + P (X = 5) − P (X = 4 ∩ X = 5)

= P (X = 4) + P (X = 5)

The last equation follows because you can’t get both 4 and 5 heads in the same 5 flips; they’re mutually exclusive. Now we just plug in the Binomial distribution with k = 4 and k = 5, separately, and add the resulting probabilities:

P (X = 4) + P (X = 5) = (^) 4!(55!−4)! 0. 54 (1 − 0 .5)^5 −^4 + (^) 5!(55!−5)! 0. 55 (1 − 0 .5)^5 −^5

= 0. 1875

7 Random Variables, Expected Value, Standard Deviation, and

Variance

We introduced random variables in Section 5, but now we can go into more detail. The set-up so far is that X is a random variable with sample space S and a probability function P (X = k) for each possible state the variable can take. Remember that all probabilities are numbers in [0,1] that sum up to 1. Let’s formalize this with an example: Example: Rolling a Die

Define the Random Variable: X is the outcome of rolling a die once.

Sample Space: S = { 1 , 2 , 3 , 4 , 5 , 6 }. These are the possible results of the experiment.

Probability Mass Function: f (k) = P (X = k) = 1/6 for all k ∈ S. Because these probabilities sum to 1, implicitly we can say that the probability of any other outcome (such as rolling a 7 with the die) must be zero. (Also remember that all probabilities must be non-negative numbers!)

Example: Football. Suppose a football team is lining up to kick a field goal. One of three possibilities will result: either the team will successfully score 3 points on the field goal with probability 1/2, they will fake the field goal and instead score a 6-point touchdown with probability 1/6, or they will score no points with probability 1/3. What is the probability mass function for the number of points they’ll score on this play?

Define the Random Variable: X is the number of points the team will score on the next play.

Sample Space: S = { 0 , 3 , 6 }. These are the possible results of the play.

Probability Mass Function: f (0) = P (X = 0) = 1/3; f (3) = P (X = 3) = 1/2; f (6) = P (X = 6) = 1 /6. For any number of points k ∈ SC^ , we can say that f (k) = P (X = k) = 0. That is, for the situation in question, it is not possible to score anything but 0, 3, or 6 points on the next play.

∑^6

k=

k =

Notice the boldfaced k two lines above. This is the point at which we’re substituting g(k) = k in the formula. From there, the rest of the problem is identical to the previous Rolling a Die example in which we computed E[X].

Example: Rolling a Die II. You are given the opportunity to roll a fair die. Whatever number results, you will win the square of that number in dollars. There is a 5 dollar entry fee to roll the die. How much money can you expect to win in one roll?

In the previous Rolling a Die example we defined the random variable X to be the outcome of the die. The sample space of X is S = { 1 , 2 , 3 , 4 , 5 , 6 }, and the probability mass function is f (k) = P (X = k) = 1/ 6 for all outcomes k in the sample space S. For any outcome k ∈ S, we win a total of g(k) = k^2 − 5 dollars. We can compute the expected winnings E[g(X)] as follows:

E[g(X)] =

k∈S

g(k)f (k) =

k∈S

g(k)P (X = k) =

∑^6

k=

g(k)(1/6)

∑^6

k=

k^2 -5 =

[

(1^2 − 5) + (2^2 − 5) + (3^2 − 5) + (4^2 − 5) + (5^2 − 5) + (6^2 − 5)

]

7.2 Variance and Standard Deviation

We have previously worked with the standard deviation as our primary measure of the spread in a data set. However, it’s often easier to forego the square root entirely in the middle of our analysis and then throw it back in at the end. (This will become abundantly clear when we discuss sums of random variables in Section 7.4.) The variance of a random variable is just the square of its standard deviation. Our intuitive notion of the standard deviation when we studied it early in the class was that it was the average distance of the data from the mean. In a random variable setting, we haven’t collected the data, so instead of talking about averages and means, we need to phrase everything in terms of expectations. Therefore, we think of the variance V ar(X) of a random variable X as the expected distance of the data from the data’s expected value. This is given by the following definition:

Variance of X: V ar(X) = E[(X − E[X])^2 ] = E[X^2 ] − (E[X])^2. (25)

The first equality in 25 is the definition of variance. The second equality is a computing formula that is often a bit easier to work with in practice. Here is a quick proof of their equivalence:

E[(X − E[X])^2 ] = E[(X − E[X])(X − E[X])] = E

[

X^2 − 2 XE[X] + (E[X])^2

]

= E[X^2 ] − 2 EX + (E[X])^2 = E[X^2 ] − (E[X])^2.

Please note, and this is important: Remember that E[X^2 ] 6 = (E[X])^2. The left side of this inequality is an expectation of a function of a random variable. We have g(X) = X^2 , and we are computing its expectation E[g(X)]. The right side of the inequality first computes E[X] and then squares the result. A good way to remember that these quantities are not equal is to think about what would happen if they were equal: if so, then V ar(X) would have to be zero (just by subtracting the right side from the left). However, if V ar(X) = 0, then X is not a random variable. So the inequality must hold for any random variable. Furthermore, since V ar(X) is never negative, E[X^2 ] ≥ (E[X])^2. (If you go on to study more probability, you’ll see this as an example of Jensen’s Inequality, but you absolutely don’t have to worry about that for this class.) Meanwhile, we can define the standard deviation SD(X) in terms of the variance:

SD of X: SD(X) =

V ar(X) =

E[(X − E[X])^2 ] =

E[X^2 ] − (E[X])^2. (26)

Example: Rolling a Die. You are given the opportunity to roll a fair die. Whatever number results, you will win that many dollars. What is the variance of your winnings for one roll?

Let X represent the outcome of the roll. We previously computed E[X] = 3.5 in Section 7.1. Now we need to compute E[X^2 ]. To do so, let g(X) = X^2 :

E[X^2 ] = E[g(X)] =

∑^6

k=

g(k)P (X = k)

∑^6

k=

k^2 (1/6) =

[1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 ] =

Then V ar(X) = E[X^2 ] − (E[X])^2 = 15. 17 − (3. 52 ) = 2.917.

Additionally, we have SD(X) =

V ar(X) =

Example: Football. A football team will either score 3 points with probability 1/2, score 6 points with probability 1/6, or score 0 points with probability 1/3. What is the variance of the number of points they’ll score?

Let X represent the number of points the team will score on the next play. When we saw this scenario in Section 7.1, we found that E[X] = 2.5. Now we need to compute E[X^2 ]. Let g(X) = X^2 , and we’ll compute E[g(X)]:

E[X^2 ] = E[g(X)] =

k∈{ 0 , 3 , 6 }

g(k)P (X = k)

k∈{ 0 , 3 , 6 }

k^2 P (X = k) = 0^2 (1/3) + 3^2 (1/2) + 6^2 (1/6) = 10. 5

V ar(X) = E[X^2 ] − (E[X])^2 = 10. 5 − (2. 52 ) = 4.25.

As a result, SD(X) =

V ar(X) =

7.3 Continuous Random Variables

So far we have been concentrating on random variables that can only take a discrete number of outcomes. However, there’s no reason we have to limit ourselves to such characterizations; if we want to study time, age, height, weight, distance, or any number of naturally continuous quantities, then it helps to have concepts of probability for continuous random variables.

Just as in the discrete case, we must specify a sample space S(X) for a continuous random variable X. If we’re studying the time it takes to complete an exam, then it makes sense to work with a subset of the positive real numbers as S(X); if you’re allowed one hour to complete the test, then this could be S(X) = [0, 1]. Then, in the discrete case, we assigned probability values to each outcome using a probability mass function (PMF). However, this poses a real problem for continuous random variables: first of all, we can’t even list all the numbers in [0, 1]. Furthermore, if we assigned positive probability to each of the infinite outcomes in this interval, then it would be impossible to do so in such a way that the probabilities would sum to one. Therefore, the notion of probability we used in the discrete case doesn’t work for continuous random variables. We can resolve this problem by instead assigning a probability density function (PDF) f (x) : x ∈ S(X) and, for any event A ⊆ S(X), we can define P (A) as the area under f (x) when considered over all values of x ∈ A. That is,

P (A) =

A

f (x)dx. (27)

Example: Continuous Triangular density. Suppose X is a random variable with probability density function f given by

f (x) =

2 x if 0 < x < 1; 0 otherwise.

Notice that f (x) has a triangular area under the curve. What is P (X > 1 /2)?

We are interested in the set of outcomes A = [1/ 2 , ∞). Then

P (X > 1 /2) = P (A) =

1 / 2

f (x)dx =

1 / 2

f (x)dx +

1

f (x)dx