data analysis

profileHd3
binomial.docx

Today we will learn about binomial random variables.

As you know, a random variable is a variable that takes on different numerical values depending on the outcome of a random experiment. For example, we had coin flips last week giving rise to either 0 or 1. Specific random variables useful in modeling have been given names, and we will focus on two: binomial and normal. This week we focus on the binomial, next week the normal.

A binomial experiment is a series of trials. You can think of a trial as a coin flip, and a binomial experiment as a series of coin flips. If the following four rules hold, then you have a binomial experiment:

1. Each trial has only two outcomes. We tend to refer to these as Success and Failure, but any two outcomes can count. Male/Female, Yes/No, Under 6 feet/Over 6 feet, responded to medication/didn’t respond to medication, etc.

2. Trials are independent. The outcome of one trial does not affect the outcome of the next trial.

3. The probability of success (p) doesn’t change for different trials.

4. The trials are repeated a fixed number (n) of times.

A binomial random variable is the number (X) of successes observed during a binomial experiment.

For example, suppose we are running a quality control experiment for a factory that manufactures light bulbs. Twenty light bulbs are tested, and each is rated on whether it meets standards or not. If we know that light bulbs will meet standards 90% of the time, then this is a binomial experiment with n=20, and p=0.90. The number out of the twenty we tested that meet standards is the binomial random variable X.

Let’s use StatCrunch to explore the probabilities for binomial random variables. Go to Stat -> Calculators -> Binomial. A window appears that has some vertical lines in a graph. This graph is displaying the theoretical probabilities for a binomial random variable. Let’s use it to see the behavior of our light bulb example. Change the value of n to 20, and the value of p to 0.90. You see that the graph changes. The x-axis tells us the possible values for our random variable X (number of light bulbs that meet standards). The height of each bar tells us how likely that outcome is.

1. Which bar is the tallest? Estimate its height using the graph.

2. Now we will use the calculator to get the exact height of the bar at X=18. In the drop-down menu next to Prob X, change the inequality to an equal sign, then type 18 in the box. Click on Calculate. What is the exact probability that there are 18 light bulbs that meet standards (and therefore two that do not)?

3. Let’s simulate the light bulb situation. Go to Data -> Simulate -> Binomial. Choose 100 rows, 1 column, n=20, and p=0.90. Then click Simulate. The values that are now in the workspace represent 100 simulated quality control checks. Create a bar chart of the results (Graph -> Bar Plot -> with data, select the correct column, then click Create Graph). Does this graph look like the theoretical graph you made above?

4. Repeat the simulation from number 3. Does the new graph look like the old one? Does it look like the theoretical one?

5. Repeat the simulation a third time, but instead of simulating 100 quality control checks, simulate 10000. Now does the graph look like the theoretical one? Why is this the case?

Let's examine a real situation where the binomial distribution applies. In an experiment designed to test whether pre-verbal children have a sense of right and wrong, 16 babies were shown two plays. (https://www.youtube.com/watch?v=anCaGBsBOxM) In one play, a triangle helps another toy, in the other, a square keeps another toy from a goal. After being shown the videos, the children are offered a choice of the helper toy or a hinderer toy. 14 of the 16 babies chose the helper toy. The question is: does this constitute evidence that babies do have a preference for the helper toy? To address the question, we will look at the situation that would hold if babies do NOT have a preference. If babies don't have a preference, then each toy had an equal probability of being chosen.

6. If each toy had an equal chance of being chosen, then what is the probability of choosing a helper toy?

7. There were 16 children, so their different choices between helper toy and hinderer toy can be modeled as a binomial random variable, where n=16, and p is the value you got above. The outcome X is the number of children that chose the helper toy. Get the theoretical distribution for this binomial random variable, and paste it here.

8. What is the probability of getting exactly 14 children choosing the helper toy? What is the probability of getting 14 or more?

What we see here is that if the children had no preference between helper and hinderer, then an outcome like the one that actually happened (14 chose helper) is very rare. This leads us to believe that children DO have a preference.

Now we will look at what happens with the shape of the binomial distribution for different values of n and p.

9. Go to Stat -> Calculators -> Binomial . Set the value of p to be 0.90, and the value of n to be 10. Describe the shape of the distribution. Specifically, describe what the values on the x-axis are, and whether there is symmetry in the heights of the lines that describe how likely each x-value is.

10. Increase n to 20, 50, and 100, keeping p the same. Describe how the shape of the distribution changes. Specifically, describe what the values on the x-axis are, and whether there is symmetry in the heights of the lines that describe how likely each x-value is.

11. Now set n=20, and change the value of p. Try p= 0.1, 0.3, 0.5, 0.7, 0.9. Describe how the shape of the distribution changes. Specifically, describe what the values on the x-axis are, and whether there is symmetry in the heights of the lines that describe how likely each x-value is.

What I hope you have noticed is that if n is large and p is not too large or too small, then the shape of the binomial distribution is symmetric – the bell shape that we talked about when we discussed the empirical rule.

12. Let's review the empirical rule: what percent of the data should be within two standard deviations of the mean?

13. The theoretical values for the mean () and standard deviation () of the binomial distribution are and . (Note: We used greek letters here instead of and s because we are using population descriptions to calculate these rather than using samples.) Calculate these values for n=20 and p=0.50.

14. Generate 1000 values from a binomial random variable with n=20 and p=0.50. (Data -> Simulate -> Binomial. Choose 1000 rows, 1 column, n=20, and p=0.50. Then click Simulate.) Then count how many values are within two standard deviations of the mean (using the theoretical values you found in number 13). (You may want to rename the column. I'll pretend it's called BinSim. Stat -> Summary Stats -> Column and choose BinSim. In the Where: box, type “BinSim >= 20 and BinSim <= 22” without the quotes and replacing the numbers 20 and 22 with the correct values.) Did this fit the prediction made by the empirical rule?

s

p

n

*

=

m

)

1

(

*

*

p

p

n

-

=

s

X

m