Chapter 5: Regression - Memorial University of Newfoundland

Download Report

Transcript Chapter 5: Regression - Memorial University of Newfoundland

Stat 1510
Binomial & Poisson
Distributions
Agenda
2

The Binomial Setting and Binomial
Distributions

Binomial Distributions in Statistical Sampling

Binomial Probabilities

Binomial Mean and Standard Deviation

The Normal Approximation to Binomial
Distributions

Poisson Distribution
The Binomial Setting
3
When the same chance process is repeated several times, we are often
interested in whether a particular outcome does or doesn’t happen on each
repetition. In some cases, the number of repeated trials is fixed in advance and
we are interested in the number of times a particular event (called a “success”)
occurs.
A binomial setting arises when we perform several independent trials of the
same chance process and record the number of times that a particular outcome
occurs. The four conditions for a binomial setting are:
B
• Binary? The possible outcomes of each trial can be classified as
“success” or “failure.”
I
• Independent? Trials must be independent; that is, knowing the result of
one trial must not have any effect on the result of any other trial.
N
• Number? The number of trials n of the chance process must be fixed in
advance.
S
• Success? On each trial, the probability p of success must be the same.
Binomial Distribution
4
Consider tossing a coin n times. Each toss gives either heads or tails. Knowing the
outcome of one toss does not change the probability of an outcome on any other
toss. If we define heads as a success, then p is the probability of a head and is 0.5
on any toss.
The number of heads in n tosses is a binomial random variable X. The probability
distribution of X is called a binomial distribution.
Binomial Distribution
The count X of successes in a binomial setting has the binomial
distribution with parameters n and p, where n is the number of trials of the
chance process and p is the probability of a success on any one trial. The
possible values of X are the whole numbers from 0 to n.
Note: Not all counts have binomial distributions; be sure to check the
conditions for a binomial setting and make sure you’re being asked to count
the number of successes in a certain number of trials!
Binomial Distributions in
Statistical Sampling
5
The binomial distributions are important in statistics when we want to
make inferences about the proportion p of successes in a population.
Suppose 10% of CDs have defective copy-protection schemes that can harm
computers. A music distributor inspects an SRS of 10 CDs from a shipment of
10,000. Let X = number of defective CDs. What is P(X = 0)? Note, this is not
quite a binomial setting. Why?
The actual probability is
P(no defectives) =
9000 8999 8998
8991
×
×
× ...×
= 0.3485
10000 9999 9998
9991
Sampling Distribution of a Count
Choose an SRS of size n from a population with proportion p of successes. When the
population is much larger than the sample, the count X of successes in the sample
has approximately the binomial distribution with parameters n and p.
Binomial Probability
6
We can find a formula for the probability that a binomial random variable
takes any value by adding probabilities for the different ways of getting
exactly that many successes in n observations.
The number of ways of arranging k successes among n observations is
given by the binomial coefficient
for k = 0, 1, 2, …, n.
æ nö
n!
=
ç ÷
è k ø k!(n - k)!
Note: n! = n(n – 1)(n – 2)•…•(3)(2)(1)
and 0! = 1.
Factorial Notation
7

For any positive whole number n, its
factorial n! is
n! = n  (n1)  (n2)    3  2  1
– Also, 0! = 1 by definition.

Example: 6! = 6·5·4·3·2·1 = 720,
and
6
6!
6!
6  5  4  3  2 1
6  5 30
  




 15
 2  2! (6  2)! 2!4! (2 1)  (4  3  2 1) 2 1 2
Binomial Probability
8
The binomial coefficient counts the number of different ways in which k
successes can be arranged among n trials. The binomial probability P(X = k) is
this count multiplied by the probability of any one specific arrangement of the k
successes.
Binomial Probability
If X has the binomial distribution with n trials and probability p of success on
each trial, the possible values of X are 0, 1, 2, …, n. If k is any one of these
values,
æ nö k
P(X = k) = ç ÷ p (1- p) n-k
è kø
Example
9
Each child of a particular pair of parents has probability 0.25 of having blood type O.
Suppose the parents have five children.
(a) Find the probability that exactly three of the children have type O blood.
Let X = the number of children with type O blood. We know X has a binomial distribution
with n = 5 and p = 0.25.
æ5ö
P(X = 3) = ç ÷(0.25) 3 (0.75) 2 = 10(0.25) 3 (0.75) 2 = 0.08789
è 3ø
(b) Should the parents be surprised if more than three of their children have type O
blood?
P(X > 3) = P(X = 4) + P(X = 5)
æ 5ö
æ5ö
4
1
= ç ÷(0.25) (0.75) + ç ÷(0.25) 5 (0.75) 0
è 4ø
è5ø
= 5(0.25) 4 (0.75)1 + 1(0.25) 5 (0.75) 0
= 0.01465 + 0.00098 = 0.01563
Case Study
10
Inspecting Switches
The number X of bad switches has approximately the
binomial distribution with n=10 and p=0.1. Find the
probability of getting 1 or 2 bad switches in a sample of 10.
P( X  1 or 2)  P( X  1)  P( X  2)
10 
1
10-1  10 
  (0.1) (1- 0.1)   (0.1) 2 (1- 0.1)10-2
1
2
10!
10!
1
9

(0.1) (0.9) 
(0.1) 2 (0.9) 8
1!9!
2!8!
 (10)(0.1)( 0.3874)  (45)(0.01) (0.4305)
 0.3874  0.1937  0.5811
Binomial Mean and Standard
Deviation
11
If a count X has the binomial distribution based on n observations with
probability p of success, what is its mean µ? In general, the mean of a
binomial distribution should be µ = np. Here are the facts:
Mean and Standard Deviation of a Binomial Random Variable
If a count X has the binomial distribution with number of trials n and
probability of success p, the mean and standard deviation of X are:
μ X  np
 X  np(1  p)
Note: These formulas work ONLY for binomial distributions.
They can’t be used for other distributions!
Normal Approximation for
Binomial Distributions
12
As n gets larger, something interesting happens to the shape of a binomial
distribution.
Normal Approximation for Binomial Distributions
Suppose that X has the binomial distribution with n trials and success
probability p. When n is large, the distribution of X is approximately Normal
with mean and standard deviation
μ X  np
s X = np(1- p)
As a rule of thumb, we will use the Normal approximation when n is so
large that np ≥ 10 and n(1 – p) ≥ 10.
Example
13
Sample surveys show that fewer people enjoy shopping than in the past. A survey asked a nationwide random sample of
2500 adults if they agreed or disagreed that “I like buying new clothes, but shopping is often frustrating and timeconsuming.” Suppose that exactly 60% of all adult U.S. residents would say “Agree” if asked the same question. Let X =
the number in the sample who agree. Estimate the probability that 1520 or more of the sample agree.
1) Verify that X is approximately a binomial random variable.
B: Success = agree, Failure = don’t agree
I: Because the population of U.S. adults is greater than 25,000, it is reasonable to assume the
sampling without replacement condition is met.
N: n = 2500 trials of the chance process
S: The probability of selecting an adult who agrees is p = 0.60.
2) Check the conditions for using a Normal approximation.
Since np = 2500(0.60) = 1500 and n(1 – p) = 2500(0.40) = 1000 are both at least 10, we may use
the Normal approximation.
3) Calculate P(X ≥ 1520) using a Normal approximation.
μ  np  2500(0.60)  1500
  np(1  p)  2500(0.60)(0.40)  24.49
z=
1520 -1500
= 0.82
24.49
P(X ³1520) = P(Z ³ 0.82) =1- 0.7939 = 0.2061
14
Generating Binomial Random
Variables using R
Related commands in R
rbinom (k,n,p)– generating k random variables from
B(n,p)
dbinom(x,n,p) - computing the binomial probability for
X=x for B(n,p) .
i.e P(X=x)
pbinorm(x,n,p) – computing the binomial cumulative
probability for X=x for B(n,p) .
i.e P(X<=x)

Poisson Distribution
15
We have studied the discrete random
variables (yes or no type) and its
distribution. There are situations where the
response of interest is discrete and it can
take values 0,1,2,3,….
 For example, consider the number of
accidents in TCH 1?
 Number of customer calls in a call center
on a particular day

Poisson Distribution
16
A random variable X is said to have a
Poisson distribution with parameter lambda
(l) if the P(X) is of the form
P(X) = exp(-l) lx / x!
where X takes the values 0, 1, 2 ….
E(X) = V(X) = l
i.e. Mean and Variance of Poisson random
variable is same

Poisson Distribution
17
Let X follows binomial distribution. When n
is large, p is small, such that np is constant,
then distribution of X can be approximated
by the Poisson Distribution.
P(X) = exp(-l) lx / x!
where l  np

Poisson Distribution: Example
18

Let X be the number of typos in a page
X can takes the values 0, 1,2,…. But the probability
of any given page containing a typo is very very
small, say p=0.005. Assuming errors are
independent from page to page, What is the
probability that one of the 400 pages of the novel
has exactly one typo.
p = 0.005, n=400, np = l= 400*.005 = 2
P(X=1) = exp(-2) 21 / 1! = 0.270671
Poisson Distribution : Example
19
The number of requests for assistance by a
towing service is a Poisson process with
l=4 per hour. Compute the probability
that exactly 5 requests received in one
hour.
P(X=5) = exp(-4) 45 / 5! =0.1563
Poisson Distribution : Example
20
It is known from the past experience that
in a certain plant there are on the
average of 4 industrial accidents per
month. Find the probability that in a
given year there are less than 3
accidents.
Poisson Distribution : Example
21
A taxi firm has two cars which it hires out
day by day. The number of demands for
a car on each day is distributed as
Poisson distribution with mean 1.5.
Calculate the proportion of days on
which neither car is used and the
proportion of days on which some
demands is refused
22
Generating Poisson Random
Variables using R

Related commands in R
rpois (k, l)– generating k random variables from
Poisson distribution with parameter l
dpois(x, l) – computing the Poisson probability for
X=x for Poisson Distribution with parameter l
i.e P(X=x)
ppois(x, l) – computing the Poisson cumulative
probability for X=x for Poisson Distribution with
parameter l. i.e P(X<=x)