Download Math 1710 Lab 1 Merged Bernoulli Trials and Binomial Experiments

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Statistics wikipedia , lookup

Probability wikipedia , lookup

Randomness wikipedia , lookup

Ars Conjectandi wikipedia , lookup

Transcript
Math 1710 Lab 1
Merged Bernoulli Trials and Binomial Experiments
Lab
Math 1710
Cornell University
1
Introduction
Originally this was a two part lab, but in part because of our missing lab times in the Fall, we will
be doing this combined lab.
(a) Sometimes in class everyone tosses 4 coins to see how many heads appear. When everyone’s
results are graphed together, you see the distribution of the number of heads for several such
tosses. This graph, based on experimental results, approximates the theoretical distribution of
the number of heads in 4 tosses of a fair coin. To see an even better estimate of this distribution,
you should toss the 4 coins 100 (or, better, 1000) times, which would be time-consuming, and
probably pretty boring. Let’s simulate the process with JMP.
(b) First, you need to know the official terminology and notation.
Tossing a coin is one example of a Bernoulli Trial.
There are only two outcomes, heads and tails. These are commonly called “Success” and
“Failure”.
The probability of success (denoted p) is constant from trial to trial.
In a Binomial Experiment we repeat independent, identical Bernoulli Trials some number of
times (denoted n), and define a random variable X = the number of Successes (e.g. heads).
You will be studying binomial probabilities next week in class.
2
Initial Exercise
Now we will simulate this Binomial experiment with 1 random variable for 100 times (cases). There
are 4 Bernoulli trials per experiment with the probability of success = 0.5. Notice this is a Binomial
experiment with n = 4 and p = 0.5.
(a) Create Data Tables
Select File > New > Data Table to create an empty data table. A new data table
has one column and no rows.
Double-click on the data table name at the left (Untitled). Type the new name (Lab 1).
Double-click on the column name (Column 1). Type the new name (Binomial 1).
(b) Add New Rows
Select Rows > Add Rows to open the Add Rows window.
1
Type the number of rows to add (100). Click OK. 100 empty rows are added to the
data table.
(c) Generate Random Numbers
Click the column name (Binomial 1) to select it. Select Cols > Formula to open the
Formula window.
Select Random > Random Binomial in the Functions list to the right.
The formula Random Binomial(n, p) should appear in the bottom of the formula
window. (You could also just type it there.) Edit the value of n (to 4) and p (to .5.) (Doubleclicking on first the “n” and then the “p” may be the easiest way to enter the numerical values.)
Click OK. The values of the random variable are displayed in the column (Binomial 1). There
should be 100 results between 0 and 4, indicating how many heads appeared each time the 4
coins were tossed.
(d) Plot Histograms
Select Analyze > Distribution to open the Distribution window. Select Binomial 1 in
Select Columns. Click OK to open the plot window.
Right-click (e.g. control-click on a mac) the title bar (Binomial 1). Select Display Options > Horizontal Layout, Histogram Options > Count Axis, and Display Options
> Axes on Left. The number of times in the 100 simulations we ended up with 0, 1, 2, 3, or
4 heads are summarized in the histogram.
Right-click over the axis. Select Axis Settings to manipulate the axis. Right-click
inside the plot. Select Background Color, Line Width Scale, and Customize, etc. to
customize the plot. You may need to fix the plot so the bars make sense. Specify the alignment
of the bars at a whole number (here 0) with bar width equal to 1. On this graph, you may
want to have 1 bar per label on the X-axis, but often 5 is the best. You can also option-click
on the hotspot (red-triangle) to the left of the Title Bar Binomial 1, and for example, make
the outlier boxplot go away.
Right-click inside the plot. Select Edit > Copy Graph to copy the histogram to the
clipboard.
Minimize the plot window rather than closing it, so you can recall the histogram.
(e) Add New Columns
Select Cols > New Column to open the New Column window. Type the column name
(Binomial 2). Click OK. A new column is added to the data table.
Now you can do another binomial experiment in the new column (Binomial 2)...
Got it? OK, you’re ready to do the activities. Please do both “Part 1” and “Part 2”.
3
Part 1 Activity
(a) Graph the distribution of the number of heads you might see if you tossed 50 coins.
2
Run 100 simulations (cases).
Write a sentence or two describing the result.
(b) Now consider a different binomial situation: a multiple choice test, each question having 4
choices. You do not know any of the answers and simply guess at every one.
Suppose the test has 7 questions. Describe this situation. (What is one Bernoulli trial?
What is the probability of success? How many trials in this Binomial experiment? Define an
appropriate random variable.)
How many might you get right by guessing? Simulate this experiment 100 times, and
graph the distribution.
Describe what the graph shows you. Compare this graph to the first one we did involving
the tossing of 4 coins. How are they different? Do you have a reasonable chance to get a
respectable grade (3 or 4 right) by guessing? (Select Histogram Options > Prob Axis.)
4
Part 2 Activity
You may find reviewing the appendix of this lab on terminology to be helpful at this point.
(a) About 90% of newly manufactured computer chips work perfectly. The rest fail because of
random impurities in the silicon. Suppose that quality control inspectors select 50 chips at
random as they emerge from the manufacturing process, and test them.
Explain why testing a chip can be considered a Bernoulli trial.
Define a binomially distributed random variable X, specifying the values of n and p.
Create an approximation of this binomial distribution by running 20 simulations. Plot a
histogram from the simulation. (Recall Generate Random Numbers and Plot Histograms
from the Initial Exercise.)
Describe the histogram.
(b) Suppose the standard medication given to people with a certain kind of skin rash has proven
to be effective for 60% of the sufferers. Now a researcher thinks she has discovered a new and
better treatment. She will test this new medication on 40 subjects.
If the 40 subjects had been treated with the old medication, how many might have been
cured? Define an appropriate random variable, run 20 simulations, and create a graph of the
distribution. (Recall Generate Random Numbers and Plot Histograms from the Initial
Exercise.)
Describe the result and compare it to the one created above.
How many patients would the new medication have to cure in order to really convince
you that it is definitely more effective than the old treatment?
3
5
The End
Please print out and hand in your completed lab at the beginning of the lab next week.
6
Show the results (plots, tables, reasoning and calculation processes etc).
Answer the questions.
Remember to write down your section number and staple what you hand in.
Appendix on Terminology
This originally was the first part of the second lab on this topic.
(a) Terminology
One Bernoulli Trial : an event with only two outcomes: failure and success
We designate the probability of success with p
Example
One Bernoulli Trial : tossing a fair coin once
Success: head
Failure: tail
(b) Terminology
One Binomial Experiment: consisting of a series of independent, identical Bernoulli Trials
n the number of Bernoulli Trials in one experiment.
p the probability of success in each of the independent trials; p remains the same from
trial to trial.
X the number of successes in one experiment.
Example
One Binomial Experiment: tossing a fair coin 5 times.
n = 5 (There are 5 Bernoulli Trials in the experiment.)
p = 0.5 (The probability for the coin to land on its head is half since it’s a fair coin.)
X = the number of heads we get if we toss a fair coin 5 times.
(c) Terminology
Binomial Random Variable: X = the number of successes in one binomial experiment.
X is called a Binomial Random Variable since it’s used to describe the result of a Binomial
Experiment.
X is a random variable since the outcome of each experiment is random, X can take on
any value of 0, 1, 2, · · · up to n. The parameters for a Binomial Random Variable are (n, p).
Distribution of X:
4
Table 1: Distribution of X
X
Probability
0
P r(X = 0)
···
···
1
P r(X = 1)
Binomial probability: P r(X = k) =
n
k
k
P r(X = k)
···
···
n
P r(X = n)
pk (1 − p)n−k , k = 0, 1, · · · , n
Example
An appropriate random variable for the above example is: X = the number of heads we get in
5 tosses.
The distribution of X tells us the values of P r(X = 0), · · · , P r(X = 5).
You can evaluate the distribution of X by the binomial probability formula.
For instance, P r(X = 1) = 51 ( 12 )1 ( 21 )5−1 = 5 · 0.55 = 0.15625
(d) Histogram: a graphic summary of the observed distribution of a random variable.
Y-axis: the frequencies or relative frequencies
X-axis: the observed outcomes of the variable
(e) Pattern: an important idea in descriptive statistics.
Overall pattern includes notions about:
shape (bell-shaped, multi-mode; symmetric, skewed)
center (mean, median)
spread (interquartile range, standard deviation)
5