1 lecture 5 binomial random variables many experiments are like tossing a coin a fixed number of...

44
Lecture 5 1 Binomial Random Variables Many experiments are like tossing a coin a fixed number of times and recording the up-face. * The two possible outcomes are Heads and Tails. * Each outcome has an associated probability. * For a fair coin, P(Heads) = P(Tails) = .50 * X = # of Heads (or Tails) in n trials constitutes a Binomial Random Variable

Upload: godwin-black

Post on 28-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Lecture 5

1Binomial Random Variables

Many experiments are like tossing a coin a fixed number of times and recording the up-face.

* The two possible outcomes are Heads and Tails.* Each outcome has an associated probability.* For a fair coin, P(Heads) = P(Tails) = .50* X = # of Heads (or Tails) in n trials constitutes a Binomial Random Variable

Lecture 5

2Binomial Random Variables

X is binomial because there are only two possible outcomes.

* In a coin toss, these outcomes are Heads, Tails.

X is random because the outcome is not predictable in advance (in practice vs. in principle)

X is a variable: the outcome of interest (e.g., the # of Heads in n tosses) varies from one set of n tosses to the next set of n tosses.

Lecture 5

3Binomial Random Variables

* The same logic works with experiments similar to a series of coin tosses.* Our Binomial Random Variable is the # of times an outcome of interest occurs.* Example: a sample of UWO students are asked whether they favor building a new rec center.* The BRV would be X, the number of students in favor out of n students in the sample.

Lecture 5

4Necessary Conditions for a BRV

1. The experiment consists of n identical trials

2. There are only 2 possible outcomes, called success (S) & failure (F) (labels are arbitrary)

3. P(S) = p. P(F) = q = (1-p). P and q are constant across trials.

4. Trials are independent of each other (because p and q are constant across trials)

5. BRV X = # of successes in n trials.

Lecture 5

53 ways to compute a binomial probability

It is often of interest to know the probability of obtaining X successes in n trials of a binomial experiment. There are 3 ways to determine that probability.

1. Table look-up

2. Binomial expansion formula

3. Normal approximation to the Binomial

Lecture 5

6BRV – Method #1

Our preferred method of determining a binomial probability is to look it up in the Binomial Probability Table, found in Table II, Appendix A, in the text.

Table II contains cumulative probabilities – that is, for any X, the table gives the probability of observing X or fewer successes in n trials.

Lecture 5

7BRV – Method #2

Expansion Formula:

P(X) = ( )pxq(n-x)

(X = 0, 1, 2, … n)

p = probability of success on a single trial

q = 1 – p

n = number of trials observed

x = # of successes on those n trials

nx

Lecture 5

8BRV – Method #2

Why use this ugly expansion formula instead of a table?

* Table II applies only for values of n = 5, 6, 7, 8, 9, 10, 15, 20, 25, and for a particular set of p values.

In other cases:* When n is small, use the expansion formula.* When n is large, use normal approximation.

Lecture 5

9BRV – Method #3

When n is large and p is not too close to 0 or 1, we can use the normal approximation to the binomial probability distribution.

How can you tell if the normal approximation is appropriate in a given case?

Use the approximation if np > 5 and nq > 5

BRV – Method #3

Histogram Normal curve

XThe histogram shows the probabilities of different values of the BRV X. Because area gives probability, we can use the area under a section of the normal curve to approximate the area of some part of the histogram

Lecture 5

11BRV – Method #3

In order to use the normal approximation, we have to be able to compute the mean and standard deviation for the BRV (in order to work out Z).

μ = np (# of observations times P(Success))

σ = √npq

There’s just one other issue to deal with…

BRV – Method #3

X1 2 3 4 5 6 7 8 9 10

Notice how the rectangle for 7 runs from 6.5 to 7.5. The probability of X values up to and including 7 is given by the area to the left of 7.5. That is the area we want to approximate with the normal curve in this case.

Notice how the normal curve misses one top corner of the rectangle for 7 and overstates the other top corner – these two errors cancel each other.

Lecture 5

13BRV – Example 1

Air Canada keeps telling us that arrival and departure times at Pearson International are improving. Right now, the statistics show that 60% of the Air Canada planes coming into Pearson do arrive on time. (This actually is an improvement over 10 years ago when only 42% of the Air Canada planes arrived on time at Pearson.) The problem is that when a plane arrives on time, it often has to circle the airport because there’s still a plane in its gate (a plane which didn’t leave on time). Statistics also show that 50% of the planes that arrive on time have to circle at least once, while only 35% of the planes that arrive late have to circle at least once.

Lecture 5

14BRV – Example 1

a). Of the next 15 Air Canada planes that arrive at Pearson, what’s the probability that fewer than 5 of them arrive late?

P(late) = .40 (because P(on time) = .60)

P(X < 5) = P(X ≤ 4) = .217 (from Table for n = 15)

Lecture 5

15BRV – Example 1

b) Of the next 8 Air Canada planes that arrive late at Pearson, what’s the probability that no more than 6 of them can land without having to circle at least once?

P(Land │Late) = .65P(X ≤ 6) = 1 – P(X > 6)

= 1 – P(X = 7 U X = 8) = 1 – 8 (.65)7 (.35) – 8 (.65)8 (.35)0

7 8( ) ( )

Lecture 5

16BRV – Example 1

P (X ≤ 6) = 1 - .1373 - .0319

= .8308

c) Of the next 80 Air Canada planes that arrive at Pearson, what’s the probability that between 40 and 45 (inclusive) have to circle at least once?

Lecture 5

17BRV – Example 1

First, we check to see whether we can use the normal approximation. To do this, we need to know the probability that a plane has to circle at least once:

P(C) = P(C ∩ Late) + P(C ∩ Not Late)

= P(L) * P(C │L) + P(L) * P(C│L)

= .35 (.40) + .6 (.5)

= .44

Lecture 5

18BRV – Example 1

Now we can do the check:

n = 80. p = .44 and q = (1 – p) = .56

np = 80 (.44) = 35.2 > 5

nq = 80 (.56) = 44.8 > 5

Thus, it’s OK to use the normal approximation.

Lecture 5

19BRV – Example 1

μ = np = 80 (.44) = 35.2

σ = √npq = √80(.44)(.56) = 4.44

Correction for continuity: to get area for 40 and up, we use X = 39.5. To get area for 45 and below, we use X = 45.5

Lecture 5

20

35.2 40 45

40 and up starts at 39.5 45 and below starts at 45.5

Lecture 5

21BRV – Example 1

Z39.5 = 39.5 – 35.2 = +.97

4.44

Z45.5 = 45.5 – 35.2 = +2.32

4.44

P(.97 ≤ Z ≤ 2.32) = .4894 - .3340 = .1558.

That is the probability that between 40 and 45 (inclusive) of the next 80 planes have to circle at least once.

Lecture 5

22

35.2 40 45

From here down = .5 + .3340 = .8340

From here down = .5 + .4894 = .9894

Lecture 5

23

35.2 40 45

Using the normal approximation, we estimate the area of these rectangles to be .1558

Lecture 5

24Introduction to Hypothesis Testing

As scientists, we often want to make inferences from what is true of a sample to what is true of the population it came from.

Logic of this approach:

1. Make a hypothesis (“X”) about a population

2. Say, if “X” (the hypothesis) is true in the population, then something very much like “X” should be true in the sample

Lecture 5

25Introduction to Hypothesis Testing

Logic of this approach (continued):

3. Measure the sample and find out if “X” is true in the sample. This gives you a FACT.

4. Make a decision as to whether “X” is true in the population. This is a CONCLUSION.

* Note the distinction between FACT and CONCLUSION.

Lecture 5

26Hypothesis Testing Example

A bag contains 100 marbles. Each marble is either red or blue. One of two conditions exists with respect to the numbers of red and blue marbles.

HO: There are equal numbers of red & blue marbles

HA: 60% of the marbles are blue.

Lecture 5

27Hypothesis Testing Example

HO: There are equal numbers of red & blue marbles

We call this hypothesis the Null Hypothesis. HO is the hypothesis of no effect, no difference.

In this example, no difference in # of red vs. # of blue marbles in the bag.

Real-life application: we administer a new therapy to patient group A and a placebo to group B. HO says that the two groups are not different in the severity of their disorder afterwards – that is, the therapy has no effect.

Lecture 5

28Hypothesis Testing Example

HA: 60% of the marbles are blue.

HA – the Alternative Hypothesis – says that there is a difference (in this case, the difference is specified)

* In this example, a difference between the # of red and the # of blue marbles in the bag.* Real-life application: HA predicts a difference in disorder severity between group that got new therapy and group that got placebo.

Lecture 5

29Hypothesis Testing Example

Which hypothesis is true (HO or HA)?

You do an experiment:* you randomly select 10 marbles one at a time, with replacement, and record X = the # of blue marbles.

You have a decision rule:* You decide that if 7 or more of the 10 marbles are blue, you will conclude that HA is true.

Lecture 5

30Hypothesis Testing Example

Again, note this decision rule:

*You decide that if 7 or more of the 10 marbles are blue, you will conclude that HA is true.

* That is, if X ≥ 7, you conclude that HA is true.

* Our conclusion depends upon a number (an observation).

Lecture 5

31Hypothesis Testing Example

a. Suppose that HO is true. What is the probability that you WRONGLY conclude that HA is true?

HO: P(Blue) = .5

HA: P(Blue) > .5

What is P(X ≥ 7 │P(Blue) = .5)? (What is X?)

We call that value α (“Alpha”) – the probability of falsely rejecting HO.

Lecture 5

32Hypothesis Testing Example

Notice what we’re doing here. Suppose that – unbeknownst to us – HO is true.

We take 10 marbles out of the bag. Even though red and blue marbles are equal in number, we might by bad luck get more blue ones than red ones. We might even get 7 or more blue ones. What is the probability that we do that?

Lecture 5

33Hypothesis Testing Example

P(X ≥ 7 │P(Blue)=.5) = 1 – P(X ≤ 6)

= 1 - .828 (from Table)

= .172

Lecture 5

34Hypothesis Testing Example

b. If, in fact, HA is true, what is the probability that you WRONGLY conclude that HO is true?

* This value is called β (“Beta”)

* β is the probability that you fail to reject HO when you should in fact reject it.

* You will reject HO if fewer than 7 of the 10 marbles taken from the bag are blue.

P(X ≤ 6 │P(Blue)=.6) = .618 (from Table)

Why is p = .6 here?

Lecture 5

35BRV – Example 3

Records for the last 5 years at UWO show that only 20% of students taking an Honors degree in Psychology fail to get a full time job within 6 months of graduating.a) I send out a survey to 4 randomly selected Honors Psychology graduates from last year. What is the probability that all are employed full time?b) In a random sample of 15 previous graduates, what is the probability that more than 5 are not employed full time?

Lecture 5

36BRV – Example 3

a. n and x are small, so use Expansion Formula

n = 4 and x = 4, so:

4! (.8)4 (2)0 = .4096

4! 0!

Lecture 5

37BRV – Example 3

b. Here, n = 15, and the question is, what is the probability that X > 5?

P(X > 5) = P(X ≥ 6) = 1- P(X ≤ 5)

We’re told that p = .20 We remember that Table II gives cumulative probabilities, so…

P(X > 5) = 1 - .939 (from Table II)= .061

Lecture 5

38BRV – Example 4

There’s a new game in Las Vegas in which a customer is handed a fair coin and allowed to flip it 25 times. If she gets 15 or more heads, she wins. You are hired by the Las Vegas Police to check out this game.

You watch the game in the morning. Only 8 people played, and they all lost. What is the probability that this happened by chance?

Lecture 5

39BRV – Example 4

In answering this question, keep in mind the following distinctions:

A. 1 flip of the coin

B. 1 play of the game (= 1 experiment)

C. How you win when you play this game

Lecture 5

40One flip of the coin

25 flips = 1 play (1 trial of the experiment)

8 people play the game once each

Lecture 5

41BRV – Example 4

To answer this question, we need:

1. The probability of getting heads when you flip the coin once.2. The probability of one person getting 14 or fewer heads when they flip the coin 25 times (and thus losing).3. The probability that 8 out of 8 people get 14 or fewer heads when they each flip the coin 25 times.

Lecture 5

42BRV – Example 4

1. P(Heads) on any flip = .5 (if coin is fair).

2. With 25 flips, from Table II,

P(X ≤ 14) = P(losing game) = .788* Therefore, P(losing) for any one person is .788

Lecture 5

43What is p that 8 out of 8 players lose?

What is the probability that 8 out of 8 customers lose? (We define “success” as losing here.)

P(X = 8) = ( ) (.7888) (.2120) = .1487

So, you might be suspicious that the game is fixed – because it’s very unlikely that 8 out of 8 players would lose. (Not impossible, but unlikely).

8

8

Lecture 5

44P(Heads) = .5

P(losing) = .788

P(8 out 8 people lose) = .1487