Discrete and continuous distributions

Content of the topic


Binomial, Poisson and hypergeometric distributions

FAMOUS DISCRETE AND CONTINUOUS DISTRIBUTIONS

HERE IS A PROBLEM

We know the total number of elements: N

We know the number of defective elements: K

We only know the %, or the expected or the average value, or the probability

It is time to see how the three most important discrete distributions, namely the hypergeometric, the binomial and the Poisson distributions work.

Let's see a story for each of them.

This is in essence the story where we have 30 balls in a box and 12 of them are red.

If we take out 7 balls, what is the probability that 2 of them are red?

This is a bit different situation, because it is not exactly 12 days when crashes occur, but 12 days on average.

This Poisson will be even more exciting.

The question is the same in all three stories: what is the P(X=2) probability?

The answer, however, will be different for each story.

In the first two stories, X is the number of days when crashes occurred. In the third story, X is the number of crashes.

These two stories are similar in terms of not knowing the exact number of crashes that occur during the 30 days. We only know the expected number.

They are different, however, in terms of what X represents. In one story, it is the number of days with crashes, in the other it is the number of crashes. This is a fundamental difference.

So this λ is the expected value of the Poisson distribution.

We could take a look at the expected values of the other two distributions as well.

There are separate formulas for that.

Let's see the standard deviations, too.

There are separate formulas for this for each distribution.

And now let's see the probabilities.

On a certain road crashes occurred on 12 out of 30 days. We pick one week out of this 30-day period. What is the probability that there were 2 days with crashes on that week?

=days with crashes

The total elements are N=30 days, and the days with crashes are the bad, K=12.

 The sample is n=7, and here we want k=2 days with crashes.

On a certain road, on average, crashes occur on 12 days out of 30 days. What is the probability that on a given week there are 2 days with crashes?

=days with crashes

Even with exceptionally bad luck, there cannot be more than 7 days with crashes in a week, so here

 HAS A LIMIT, MAX 7.

 , because we pick 7 days

 days with crashes

On a certain road in a 30-day period, on average there are 12 crashes. What is the probability that on a given week there are 2 crashes?

=crashes

There can be any number of crashes - there are 12 on average in every 30 days. But who says there couldn't be 1000 crashes? So here

 HAS NO LIMIT

[K1]  is the expected value

[K2] the number of crashes expected to occur in a week

There are 12 crashes in 30 days, so the number of crashes per day is 12/30=0.4.

Seven times of 0.4 is 2.8, so 2.8 crashes are expected in one week.

In the previous slideshow, we started looking at the three most important discrete distributions, so now we should look at some exercises.

On average, 24 customers arrive to the bank in an hour.

What is the probability of exactly 2 people arriving within 7 minutes?
What is the probability of maximum 2 people arriving within 7 minutes?
What is the probability of minimum 2 people arriving within 5 minutes?

On average, 24 customers arrive in an hour, but this is only the average. So, it can happen that in one hour, nobody comes, and in the next, 50 customers show up. The number of customers has no limit, it could be anything. It is not likely though that in the next 7 minutes 7 billion customers come in, but who knows.

If we recall the example about road crashes: there can be a maximum of 7 days in a week when crashes occur, however, there can be 7 billion crashes in a week. So the number of customers is like the number of crashes.

So, this is a POISSON DISTRIBUTION, which means we need the expected value.

If there are 24 customers arriving every hour, then it is 24/60=0.4 per minute. In 7 minutes it is seven times that: 2.8.

We would not expect the same number of customers in a period of 5 minutes and in a period of 7 minutes, so the expected values will be different.

If there are 24 customers arriving every hour, then it is 24/60=0.4 per minute, and in 5 minutes it is five times that number, namely 2.

___ means that ____

This is a bit too much, so let's use the complementary for the calculation.


The proper time to apply each distribution

It is time to see how the three most important discrete distributions, namely the hypergeometric, the binomial and the Poisson distributions work.

Let's see a story for each of them.

On average, 24 customers arrive to the bank in an hour.

What is the probability of exactly 2 people arriving within 7 minutes?
What is the probability of maximum 2 people arriving within 7 minutes?
What is the probability of minimum 2 people arriving within 5 minutes?

On average, 24 customers arrive in an hour, but this is only the average. So, it can happen that in one hour, nobody comes, and in the next, 50 customers show up. The number of customers has no limit, it could be anything. It is not likely though that in the next 7 minutes 7 billion customers come in, but who knows.

If we recall the example about road crashes: there can be a maximum of 7 days in a week when crashes occur, however, there can be 7 billion crashes in a week. So the number of customers is like the number of crashes.

So, this is a POISSON DISTRIBUTION, which means we need the expected value.

If there are 24 customers arriving every hour, then it is 24/60=0.4 per minute. In 7 minutes it is seven times that: 2.8.

We would not expect the same number of customers in a period of 5 minutes and in a period of 7 minutes, so the expected values will be different.

If there are 24 customers arriving every hour, then it is 24/60=0.4 per minute, and in 5 minutes it is five times that number, namely 2.

___ means that ____

This is a bit too much, so let's use the complementary for the calculation.

In a given season the probability of rain is 0.2 each day. What is the probability that there are 3 rainy days in a week?

X=number of rainy days

This definitely has a limit, as there can only be 7 rainy days in a week, at most.

At a highway checkpoint they find that out of 100 cars, on average, 12 cars commit some sort of violation. If they stop 10 cars randomly, what is the probability that

a) exactly two cars commit violations?

b) a maximum of two cars commit violations?

c) a minimum of two cars commit violations?

d) two consecutive cars commit violations?

X=cars committing violations

They stop 10 cars, so it would be surprising to find that 13 committed violations.

The number of violating cars therefore is limited to a maximum of 10.

p=the probability of a car committing some sort of violation.

If 12 out of 100 cars violate the rules, that means 12% are violators, so

This is a bit too much, so let's use the complementary for the calculation.

A car commits some violation with a probability of p=0.12. It is the same for the other car, too.

At a road checkpoint they find violations at 8 cars per hour, on average. What is the probability of finding violations at

a) three cars in 15 minutes?

b) a maximum of two cars in a half hour?

X=cars committing violations

X is the number of cars committing violations, just as before.

Previously it meant how many cars are offending out of 10 stopped cars, but now it means how many cars commit an offense within 15 minutes. 

Even in the worst case scenario, there is a maximum of 10 offending cars out of 10 cars. However, the number of offending cars in 15 minutes could be anything.

So now X has no limit, therefore it is POISSON DISTRIBUTION.

If there are 8 cars committing a violation in an hour, then in 15 minutes we need a quarter of that: 8/4=2

In a half hour, twice as many offending cars could be expected.

Finally, here comes a case where all three distributions will make an appearance.

We need to make some room for that.

A bolt of fabric has a minor defect at every 10 yards on average.

a) What is the probability that a 6-yard piece is perfect?

b) If 30 yards of fabric is cut into 6-yard pieces, what is the probability  

    that there will be exactly two pieces with defects?

c) 120 yards of fabric was cut into 6-yard pieces, resulting in 9 pieces with defects. If we pick out 5 pieces, what is the probability of 2 of them having defects?

X=number of defects

If we want the piece to be perfect, than the number of defects is presumably zero.

On average, there is 1 defect per 10 yards.

But it does not mean that they weave fabric like "oh, here is 10 yards finished again, let's put in a defect".

The defects are located in a random fashion, so there could be 2 defects in a 10-yard section, or even 13, or any number.

So this is a POISSON DISTRIBUTION, and if on average, there is 1 defect in 10 yards, then in 6 yards it is:

Y=pieces with defects

There can be any number of defects, but there can be maximum 5 pieces with defects, so Y has a limit.

Here, p is the probability of a piece having a defect.

Let's see the probability of a piece having a defect.

The previous question was about the probability of a piece being perfect.

well, the defective:

If 120 yards of fabric is cut into 6-yard pieces, there will be 20 pieces.

As it happened, 9 out of these had a defect.

We pick 5 pieces.

Z=pieces with defects


Exponential, normal and uniform distributions

Continuous random variables usually measure time, distance and stuff like how many pounds, how many gallons, etc.

Given their nature, there is no point in asking what  probability is, because all such probabilities are zero.

This can be proven easily, for instance by visiting a pub where they serve beer on tap. We will get either more or – more likely – less, but for sure, never the exact amount of beer that supposed to be in the glass.

Well, this is not the most precise way to make this point, but perhaps it helps us remember that in the case of continuous random variables, only intervals have any place in questions like  or  or

We can get the exact probabilities by using the distribution function or the density function, and in most cases we can decide which one to use. If you feel an irresistible desire towards computing integrals, go ahead and use the density function. However, your degree of suffering will be less, if you opt for the distribution function.

In Step 1 we convert the probability to a distribution function and in Step 2 we find the actual distribution function.

The distribution of events over time or distance.

UNIFORM DISTRIBUTION (ez csak úgy van)

Private Ryan is expecting a phone call between 2pm and 7pm, in each moment the chance of being called is equal. What is the probability of getting the call before 4pm?

=what time it is

                               a=10                                             b=15

The distribution function of the uniform distribution is:

       here a=10 and b=15            

Call received before noon:

[K1] 

EXPONENTIAL DISTRIBUTION

Usually 12 customers enter the bank every hour. What is the probability of 10 minutes passing without anyone entering?

=elapsed time, minutes                              

                                           0                            10                                                minutes

If nobody enters for 10 minutes, that means the elapsed time between two customers is longer than 10 minutes.

, so we want to calculate this probability:  .

The expected number of customers entering the bank in an hour is 12, so the time between customers is 0/12=5 minutes, and the expected value is

 minutes, and therefore [K2] 

The distribution function of the exponential distribution:

[K3]      here [K4]                [K5] 

Nobody enters for 10 minutes:

[K6] 

NORMAL DISTRIBUTION (the distribution of quantities)

The number of customers entering the bank in a day follows the normal distribution, with an expected value of 560 customers, and a standard deviation of 40.

This means, that usually 560 customers visit this bank daily. Sometimes more, sometimes fewer.

However, it is rare to have far more or far fewer customers in a day.

The density function of the normal distribution is:

This is a fantastic function, but unfortunately, it has a little problem. We can't find the integral of this function. I don't mean today, but at all. But no sweat, we haven’t been using the density function for calculating probabilities anyway, instead, we used the distribution function.

Only there is a little trouble. Namely, there is no presentable distribution function.

We can eliminate this minor inconvenience if we introduce a special normal distribution with an expected value of zero and a standard deviation of one.

This is called the standard normal distribution. Its density function is:

and its distribution function is defined as a table, represented by the symbol of .

Let's see the table.

Well, we have two tables here. But no need to panic, the two tables are practically the same, as we will see shortly.

The density function of the standard normal distribution is the so called Gaussian curve or bell curve.

The first table contains the values of the distribution function, in other words, the size of the area under the curve from negative infinity to z.

If z=0, then this is exactly half of the total area.

Since the area under the curve of density functions is 1, half of it is 0.5.

If z is slightly bigger than 0, then the area is slightly bigger, too.

Here comes the other table. The only difference here is that the areas start from 0.

Therefore, the areas are exactly 0.5 less than in the first table.

It doesn't matter which table we use for solving the problem, but if there is a choice, it may be worth picking the first one.

Finally, there is one more thing here.

  is indicated in the figure by this area.

is this area.

We can see that these two areas complement each other: they add up to the total area.

.

Well, this is splendid, but now let's continue solving the problem.

The normal distribution can be converted into the standard normal distribution by subtracting its expected value from , and divide it by the standard deviation. Based on this, the distribution function of the normal distribution is:

Here we have a normal distribution with an expected value of 560, and a standard deviation of 40.

The probability of having less than 616 customers on a given day is:

[K7] 

.

If we use the first table, we will find the probability we are looking for.

If we use the second table, we have to add 0.5 to the value found there.

Let’s see another one of these.

The probability of having less than 480 customers on a given day is:

[K8] 


Relationship between Poisson and Exponential distribution

THE RELATIONSHIP BETWEEN THE POISSON DISTRIBUTION AND THE EXPONENTIAL DISTRIBUTION

On average, 12 cars arrive to the gas station in an hour.

1. What is the probability of 3 cars arriving within 10 minutes?

2. What is the probability of at least 10 minutes passing between the arrivals of two cars?

While the first question is about the number of cars, the second question is about the time between their arrivals. The number of cars is a discrete distribution, and since any number of cars can arrive, it is Poisson. The time elapsed is a continuous distribution, and happens to be exponential.

1. number of cars in 10 minutes, cars, POISSON

The expected value is 12 cars per hour, so in one minute it is 12/60=0.2 and in 10 minutes it is  cars

[K1] 

2. time elapsed between two cars, minutes, EXPONENTIAL

The expected value is 12 cars per hour, so the average elapsed time is 60/12=5 minutes  minutes

[K2] 

Both distributions describe the same story: one looks at the number of occurrences, while the other looks at the time between those occurrences. So, the mysterious appearance of this  at both places is not just a coincidence. The two s are essentially the same.

We need to understand that the expected value of a Poisson distribution depends on the time period checked: a longer period will have more cars, a shorter period will have fewer. Let's say in 10 minutes , but in 15 minutes .

On the other hand, the expected value of the exponential distribution is the expected elapsed time, and that does not depend on the time period being examined. It is because on average, cars arrive every 5 minutes; let it be in a half hour, or in a 20-minutes period. So here  will always be the same.

Should it happen that with the Poisson distribution we examine a time period that is exactly the unit of the elapsed time at the exponential distribution, than the two s will be exactly the same. Let's see how this looks for our given example.

If, at the exponential distribution we measure the elapsed time in minutes, then the expected value is 5 minutes, and [K3] . Now let's take a one-minute period, and calculate  of the Poisson distribution. There are 12 cars coming every hour, so in a minute it is 12/60=0.2, in other words [K4] : the two s are the same.

If, at the exponential distribution we measure the elapsed time in hours, then the expected value of 5-minutes. Now, 5 minutes = 5/60 hours, so approximately 0.083 hours. Here [K5] . Now let's calculate  for the Poisson distribution for a period of one hour. Since the problem said 12 cars are coming every hour, it follows that . So the two s are the same in this case, too.

X = number of occurrences in a given time

Y = elapsed time between two occurrences

In an area, on average, every 16 months there is an earthquake stronger than 5 on the Richter-scale.

a) What is the probability having two such earthquakes in a year?

b) What is the probability of 3 years elapsing between two such earthquakes?

X = number of stronger earthquakes in a year

Let's see how many earthquakes occur per year.

One year is 12 months, and an earthquake occurs every 16 months.

That means there are  earthquakes in a year.

Y = elapsed time between earthquakes

X means the number of earthquakes, following the Poisson distribution, while Y means the elapsed time between earthquakes, following the exponential distribution.

So, the expected value here does not mean how many earthquakes are expected, but rather, how many months are expected between them.

 3 years = 36 months

Well, this was plenty enough of exponential distribution.

5.1.

An insurance company receives – on average – 5 home insurance claims per day.

a) What is the probability that on a day they receive fewer than the expected number of claims?

b) What is the probability that on three days in a week they receive fewer claims than expected?

X=number of claims

It can happen at any time that aliens attack Earth and then the number of home insurance claims reaches a million per day. That means X has no limit.

Y= number of days

when claims are below average

There are maximum seven days in a week, so Y has a limit.

Let's see what we know:

the probability that the number of claims in a day is below average


The "forever young" property of the exponential distribution

The useful lifetime of a smartphone follows the exponential distribution, with an expected life of 4 years.

a) What is the probability that it works at least for 3 years?

b) What is the probability that it works longer than 3 years, but less than 5?

c) What is the probability that if it has been working for 3 years, it will die in the next 2 years?

The last question will be funny.

Let's try to figure out how it is different from the previous one.

For this, let's do some drawing.

We know it has been working for 3 years,

so it will die somewhere here.

But within 5 years.

So far, this is very much like the previous question.

To understand the difference between the two questions better, take Bob.

We try to predict the probability that Bob will die between his 70th and 71st birthdays.

The question is whether this probability is high or low. Well, it depends.

If we make the prediction at the moment of Bob's birth for the probability of him dying between his 70th and 71st birthdays, then the probability will be low.

It is low, because many things can happen to Bob until then, for example he gets hit by the bus at age 5, or gets a heart attack at age 60...

On the other hand, if Bob just turned 70, and as a present for his birthday we predict his chances of dying in the next year, then we can reassure him that this probability is pretty high.

Well, this is the difference between the two types of questions.

Both cases are about the phone dying between its 3rd and 5th year,

but in one case we ask at the moment of its birth,

in the other case we ask after 3 years of operation.

this was the first question

if we still remember

Finally, there is one more funny thing.

The exponential distribution has a strange feature.

This is a feature that Bob, unfortunately, does not have.

This feature is being forever young.

In the case of Bob, who does not have this trait, if we want to know the probability of him dying within a year, then we need to know how old he is.

His chances of dying within a year are not the same at the age of 10 or 60 or even 102. As time passes, Bob indeed has an increasing chance of dying, because he is not ageless.

However, the exponential distribution is just that.

It means it doesn't matter whether those three years have passed.

We could even lie about it.

As if the 3 years in the conditions didn't even exist.


Problem with Poisson and Binomial distributions

5.1.

An insurance company receives – on average – 5 home insurance claims per day.

a) What is the probability that on a day they receive fewer than the expected number of claims?

b) What is the probability that on three days in a week they receive fewer claims than expected?

X=number of claims

It can happen at any time that aliens attack Earth and then the number of home insurance claims reaches a million per day. That means X has no limit.

Y= number of days

when claims are below average

There are maximum seven days in a week, so Y has a limit.

Let's see what we know:

the probability that the number of claims in a day is below average

5.8.

The useful lifetime of a smartphone follows the exponential distribution, with an expected life of 4 years.

a) What is the probability that it works at least for 3 years?

b) What is the probability that it works longer than 3 years, but less than 5?

c) What is the probability that if it has been working for 3 years, it will die in the next 2 years?

The last question will be funny.

Let's try to figure out how it is different from the previous one.

For this, let's do some drawing.

We know it has been working for 3 years,

so it will die somewhere here.

But within 5 years.

So far, this is very much like the previous question.

To understand the difference between the two questions better, take Bob.

We try to predict the probability that Bob will die between his 70th and 71st birthdays.

The question is whether this probability is high or low. Well, it depends.

If we make the prediction at the moment of Bob's birth for the probability of him dying between his 70th and 71st birthdays, then the probability will be low.

It is low, because many things can happen to Bob until then, for example he gets hit by the bus at age 5, or gets a heart attack at age 60...

On the other hand, if Bob just turned 70, and as a present for his birthday we predict his chances of dying in the next year, then we can reassure him that this probability is pretty high.

Well, this is the difference between the two types of questions.

Both cases are about the phone dying between its 3rd and 5th year,

but in one case we ask at the moment of its birth,

in the other case we ask after 3 years of operation.

this was the first question

if we still remember

Finally, there is one more funny thing.

The exponential distribution has a strange feature.

This is a feature that Bob, unfortunately, does not have.

This feature is being forever young.

In the case of Bob, who does not have this trait, if we want to know the probability of him dying within a year, then we need to know how old he is.

His chances of dying within a year are not the same at the age of 10 or 60 or even 102. As time passes, Bob indeed has an increasing chance of dying, because he is not ageless.

However, the exponential distribution is just that.

It means it doesn't matter whether those three years have passed.

We could even lie about it.

As if the 3 years in the conditions didn't even exist.

5.7.

At a bank, in 0.3% of the cases there is no customer arriving in an hour. The number of customers follows the Poisson distribution.

a) What is the expected number of customers per hour?

b)

X = number of customers

There is no customer in 0.3% of the cases.

We need the  that is in the exponent.

We can lure it down from there by taking the natural logarithm of both sides.

There is such a thing as:

So, bye-bye

This one is done.

5.81 customers are expected per hour.

Of course, there won't be exactly 5.81 customers arriving, unless we are at the morgue.

So this should be understood as 5.81 customers on average.

Let's see what is going on with the other question.

That looks less inviting.

X means the number of customers

If the customers are still alive, this could only be an integer.

5.8.

A newsstand sells 48 items per hour, and on average, 36 of those are newspapers. What is the probability that  a)  in 10 minutes, 2 newspapers are sold at most?  b)  in 5 minutes, exactly 7 items are sold?  c) 4 out of the 7 items sold are newspapers?

 X = number of newspapers sold in 10 minutes

X has no limit: if a group of tourists arrive from China, hungry for newspapers, then the newsstand can sell even a 1000 papers.

The average sales is 36 newspapers per hour, so it is one-sixth in 10 minutes:

X = number of items sold in 5 minutes

This is also Poisson distribution.

The expected value is 48 items per hour, thus in 5 minutes:

Z = the number of newspapers out of the 7 items sold

We don't know how many items and how many newspapers are in total.

But we know that on average, out of 48 items, 36 are newspapers: that is 75%

5.9.

The probability that the newsstand cannot sell even a single item in 15 minutes is  

a) How many do they sell per hour, on average?

b) What is the probability of selling 10 in a half hour?

c) At most, for how long cannot they sell any items with the probability of 0.6?

X = number of items sold

The sales of these newsstands always follow the Poisson distribution.

cannot sell even a single item with a probability of  

It is expected to be able to sell 6 items in 15 minutes.

Then, we can assume selling four times of that in an hour: 24 items.

Now, in a half hour, it is expected to sell 12 items:

We have no idea for how long they cannot sell anything. Let's call this time t.

Well, this is splendid, the only question is that what do we have now.

What we got is the expected value of the Poisson distribution in t time.

In other words, we can expect that this many items are bought in t time.

But how long is t?

In 15 minutes, 6 items are bought, in t time, 0.511 items.

At most, 1.2775 minutes pass such that there is still at least 60% chance of nobody buying anything.

5.10.

In a certain month, out of 30 days, 12 days have rain. What is the probability that there are 3 rainy days in a week?

X = number of rainy days

30 days total, out of which 12 are rainy:

We check 7 days, and out of that, 3 days must be rainy:

Only there is a little trouble.

Out of the 30 days, 12 are rainy, on average. This means that this year it could rain on 25 days, or only on 5 days.

So, we have no idea how many rainy days there are, we only know the average.

But X has a limit, since there could only be 7 rainy days in a week, and that means this follows the binomial distribution.

5.11.

In a book, on average there are 80 typos in 100 pages. What is the probability that there are 7 typos on 10 consecutive pages?

X = number of typos

Total number of pages is 100, on which there are 80 typos:

We check 10 pages, and there must be 7 typos:

Only there is a little trouble.

100 pages contain 80 typos on average, that means there could be 150 or even only 25, for instance.

So, we have no idea how many typos there are, we only know the average.

Out of the 10 pages we check, maximum 10 can have typos, but there can be any number of typos.

X is the number of typos, so it has no limit.

 typos are expected on 1 page

5.12.

On a certain exam, usually 60% of students fail. If 10 students are taking the exam on a day, what is the probability that

a) at most 2 students pass?

a) at least 2 students pass?

X = how many pass

Since 10 are taking the exam, definitely no more than 10 will pass.

Let's see what we know:

But, here we have a little problem.

X means how many pass, so then this p should be the probability of somebody passing the exam.

That means X and p should always refer to the same thing.

There is no problem if p is the probability of a student failing, but in that case X should mean the number of students who fail.

Since now X means how many pass, p is the probability of someone passing the exam.

5.13.

Random variable X has a uniform distribution, with an expected value of 10, and standard deviation of .

How high are these probabilities: , and  and  ?

The expected value of the uniform distribution is:

And its standard deviation:

This is a linear system.

If we add the two equations up,

Now let's see the distribution function.

5.14.

A fire station on average receives an alarm every two hours. What is the probability that

a) at most 2 alarms are received in 8 hours?

b) after receiving an alarm at 800, the next alarm will be between 930 and 1000?

X = number of alarms

The number of alarms follows a discrete distribution, and let's see...

in 8 hours, there could be any numbers, so it is Poisson.

Alarms are received usually every two hours, so in 8 hours it is expected to receive 4 alarms.

Y = elapsed time between alarms

The elapsed time is continuous and exponential.

Usually 2 hours pass between alarms, so the expected value is 2 hours.

EXP

5.15.

The number of calls to a customer service center follows the Poisson distribution, the time between the calls is a random variable with exponential distribution, and the probability that a call comes in within 5 minutes is: 

a) What is the average number of calls per hour?

b) What is the probability that in a half hour at least three calls come in?

c) What is the probability that at least 10 minutes pass between two calls?

X = number of calls

a call comes in within 5 minutes

If in 5 minutes  , then in an hour

And in a half hour

Y = elapsed time between calls

This  tends to change all the time as we go along.

Let's see what it is right now.

If 12 calls come in within a half hour,

then usually 5 minutes pass between calls:


Problem 09

Problem 10

Problem 11

Problem 12

Problem 13

Problem 14

Problem 15

Problem 16

Problem 17