Course Content
Probability Theory
Probability Theory
The Second Experiment
As we remember from the previous chapter, it was almost impossible to figure out the probability of getting exactly 1000
positive responses among 20 000
answers, with the probability of 20%
of getting a positive answer. But let's simplify it a little bit by changing the first part of the task. Here, we should calculate the probability of getting 1000
or more positive answers.
General formula:
In this experiment, we will work with the binom.sf(k, n, p)
function. This function helps calculate the probability of receiving k
or more successes among n
trials with the probability of success for each experiment p
.
Example:
from scipy.stats import binom # Calculate the probability experiment = binom.sf(k = 1000, n = 20000, p=0.20) print(experiment)
Explanation:
from scipy.stats import binom
importing object fromscipy.stats
.binom.sf(k = 1000, n = 20000, p=0.20)
the probability of getting more than1000
(inclusive) successes amoung20 000
trials with the probability of success20 %
Interesting fact:
As we remember in the previous chapter, we received 0%
, but here the probability is 1.0
or 100%
. In this case, the enormous sample was for us; further, compare this output with the output in the task, where the sample is significantly less.
Task
Here, we should cope with almost the same task as in the previous chapter, but a little bit changed.
Your task here is to calculate the probability that 5
or more kittens will find a home, there are 12
kittens in the shelter. In this city, kittens are taken from a shelter with a probability of 75%
. Import relevant library to do it.
The output here is going to be less hopeful.
The probability of that exactly 5
kittens will be taken is 0.011471271514892587.
- Import
binom
object fromscipy.stats
. - Calculate the probability that '5' or more kittens of
12
will find home with the probability of success75
%.
The output here is going to be less hopeful.
Note
As we may recognize, in both cases the probability increased from the previous chapter to this one. By the way, our result will be less if we want to calculate a defined number of successes, try to allow our experiment to have an error.
Thanks for your feedback!
The Second Experiment
As we remember from the previous chapter, it was almost impossible to figure out the probability of getting exactly 1000
positive responses among 20 000
answers, with the probability of 20%
of getting a positive answer. But let's simplify it a little bit by changing the first part of the task. Here, we should calculate the probability of getting 1000
or more positive answers.
General formula:
In this experiment, we will work with the binom.sf(k, n, p)
function. This function helps calculate the probability of receiving k
or more successes among n
trials with the probability of success for each experiment p
.
Example:
from scipy.stats import binom # Calculate the probability experiment = binom.sf(k = 1000, n = 20000, p=0.20) print(experiment)
Explanation:
from scipy.stats import binom
importing object fromscipy.stats
.binom.sf(k = 1000, n = 20000, p=0.20)
the probability of getting more than1000
(inclusive) successes amoung20 000
trials with the probability of success20 %
Interesting fact:
As we remember in the previous chapter, we received 0%
, but here the probability is 1.0
or 100%
. In this case, the enormous sample was for us; further, compare this output with the output in the task, where the sample is significantly less.
Task
Here, we should cope with almost the same task as in the previous chapter, but a little bit changed.
Your task here is to calculate the probability that 5
or more kittens will find a home, there are 12
kittens in the shelter. In this city, kittens are taken from a shelter with a probability of 75%
. Import relevant library to do it.
The output here is going to be less hopeful.
The probability of that exactly 5
kittens will be taken is 0.011471271514892587.
- Import
binom
object fromscipy.stats
. - Calculate the probability that '5' or more kittens of
12
will find home with the probability of success75
%.
The output here is going to be less hopeful.
Note
As we may recognize, in both cases the probability increased from the previous chapter to this one. By the way, our result will be less if we want to calculate a defined number of successes, try to allow our experiment to have an error.
Thanks for your feedback!
The Second Experiment
As we remember from the previous chapter, it was almost impossible to figure out the probability of getting exactly 1000
positive responses among 20 000
answers, with the probability of 20%
of getting a positive answer. But let's simplify it a little bit by changing the first part of the task. Here, we should calculate the probability of getting 1000
or more positive answers.
General formula:
In this experiment, we will work with the binom.sf(k, n, p)
function. This function helps calculate the probability of receiving k
or more successes among n
trials with the probability of success for each experiment p
.
Example:
from scipy.stats import binom # Calculate the probability experiment = binom.sf(k = 1000, n = 20000, p=0.20) print(experiment)
Explanation:
from scipy.stats import binom
importing object fromscipy.stats
.binom.sf(k = 1000, n = 20000, p=0.20)
the probability of getting more than1000
(inclusive) successes amoung20 000
trials with the probability of success20 %
Interesting fact:
As we remember in the previous chapter, we received 0%
, but here the probability is 1.0
or 100%
. In this case, the enormous sample was for us; further, compare this output with the output in the task, where the sample is significantly less.
Task
Here, we should cope with almost the same task as in the previous chapter, but a little bit changed.
Your task here is to calculate the probability that 5
or more kittens will find a home, there are 12
kittens in the shelter. In this city, kittens are taken from a shelter with a probability of 75%
. Import relevant library to do it.
The output here is going to be less hopeful.
The probability of that exactly 5
kittens will be taken is 0.011471271514892587.
- Import
binom
object fromscipy.stats
. - Calculate the probability that '5' or more kittens of
12
will find home with the probability of success75
%.
The output here is going to be less hopeful.
Note
As we may recognize, in both cases the probability increased from the previous chapter to this one. By the way, our result will be less if we want to calculate a defined number of successes, try to allow our experiment to have an error.
Thanks for your feedback!
As we remember from the previous chapter, it was almost impossible to figure out the probability of getting exactly 1000
positive responses among 20 000
answers, with the probability of 20%
of getting a positive answer. But let's simplify it a little bit by changing the first part of the task. Here, we should calculate the probability of getting 1000
or more positive answers.
General formula:
In this experiment, we will work with the binom.sf(k, n, p)
function. This function helps calculate the probability of receiving k
or more successes among n
trials with the probability of success for each experiment p
.
Example:
from scipy.stats import binom # Calculate the probability experiment = binom.sf(k = 1000, n = 20000, p=0.20) print(experiment)
Explanation:
from scipy.stats import binom
importing object fromscipy.stats
.binom.sf(k = 1000, n = 20000, p=0.20)
the probability of getting more than1000
(inclusive) successes amoung20 000
trials with the probability of success20 %
Interesting fact:
As we remember in the previous chapter, we received 0%
, but here the probability is 1.0
or 100%
. In this case, the enormous sample was for us; further, compare this output with the output in the task, where the sample is significantly less.
Task
Here, we should cope with almost the same task as in the previous chapter, but a little bit changed.
Your task here is to calculate the probability that 5
or more kittens will find a home, there are 12
kittens in the shelter. In this city, kittens are taken from a shelter with a probability of 75%
. Import relevant library to do it.
The output here is going to be less hopeful.
The probability of that exactly 5
kittens will be taken is 0.011471271514892587.
- Import
binom
object fromscipy.stats
. - Calculate the probability that '5' or more kittens of
12
will find home with the probability of success75
%.
The output here is going to be less hopeful.
Note
As we may recognize, in both cases the probability increased from the previous chapter to this one. By the way, our result will be less if we want to calculate a defined number of successes, try to allow our experiment to have an error.