Contenido del Curso
Probability Theory
Probability Theory
Binomial probability 2/2
Look at the code example of the binomial probability
# Import relevant library from scipy.stats import binom # Here, we simulate an experiment of tossing 5 coins three times experiment = binom.rvs(p = 0.5, size = 5, n = 3) print(experiment)
Explanation of the code above:
- We need to import
binom object
fromscipy.stats
. binom.rvs(p = 0.5, size = 5, n = 3)
means that the probability of getting head is 50 %,p = 0.5
; the size of sample in experiment is 5,size = 5
; the number of trial is 3,n = 3
.- In the output we can see an array with five results for each coin with the number of successful trials for each coin.
Tarea
Your task here is almost the same as in the previous chapter, play with one coin!
Imagine that here you have a coin with a general probability of 50%. Follow this algorithm:
- Import the
binom
object fromscipy.stats
. - Conduct the experiment with
binom
object usingrvs()
function:- Set
p
parameter equal to0.5
. - Set
size
parameter equal to1
. - Set
n
parameter equal to5
.
- Set
Please note, you can comment on the line where np.random.seed()
was defined and "play with the coin" to receive various outputs.
Note
Explanation of the output : We were tossing one coin five times, and it only led to success in three cases.
¡Gracias por tus comentarios!
Binomial probability 2/2
Look at the code example of the binomial probability
# Import relevant library from scipy.stats import binom # Here, we simulate an experiment of tossing 5 coins three times experiment = binom.rvs(p = 0.5, size = 5, n = 3) print(experiment)
Explanation of the code above:
- We need to import
binom object
fromscipy.stats
. binom.rvs(p = 0.5, size = 5, n = 3)
means that the probability of getting head is 50 %,p = 0.5
; the size of sample in experiment is 5,size = 5
; the number of trial is 3,n = 3
.- In the output we can see an array with five results for each coin with the number of successful trials for each coin.
Tarea
Your task here is almost the same as in the previous chapter, play with one coin!
Imagine that here you have a coin with a general probability of 50%. Follow this algorithm:
- Import the
binom
object fromscipy.stats
. - Conduct the experiment with
binom
object usingrvs()
function:- Set
p
parameter equal to0.5
. - Set
size
parameter equal to1
. - Set
n
parameter equal to5
.
- Set
Please note, you can comment on the line where np.random.seed()
was defined and "play with the coin" to receive various outputs.
Note
Explanation of the output : We were tossing one coin five times, and it only led to success in three cases.
¡Gracias por tus comentarios!
Binomial probability 2/2
Look at the code example of the binomial probability
# Import relevant library from scipy.stats import binom # Here, we simulate an experiment of tossing 5 coins three times experiment = binom.rvs(p = 0.5, size = 5, n = 3) print(experiment)
Explanation of the code above:
- We need to import
binom object
fromscipy.stats
. binom.rvs(p = 0.5, size = 5, n = 3)
means that the probability of getting head is 50 %,p = 0.5
; the size of sample in experiment is 5,size = 5
; the number of trial is 3,n = 3
.- In the output we can see an array with five results for each coin with the number of successful trials for each coin.
Tarea
Your task here is almost the same as in the previous chapter, play with one coin!
Imagine that here you have a coin with a general probability of 50%. Follow this algorithm:
- Import the
binom
object fromscipy.stats
. - Conduct the experiment with
binom
object usingrvs()
function:- Set
p
parameter equal to0.5
. - Set
size
parameter equal to1
. - Set
n
parameter equal to5
.
- Set
Please note, you can comment on the line where np.random.seed()
was defined and "play with the coin" to receive various outputs.
Note
Explanation of the output : We were tossing one coin five times, and it only led to success in three cases.
¡Gracias por tus comentarios!
Look at the code example of the binomial probability
# Import relevant library from scipy.stats import binom # Here, we simulate an experiment of tossing 5 coins three times experiment = binom.rvs(p = 0.5, size = 5, n = 3) print(experiment)
Explanation of the code above:
- We need to import
binom object
fromscipy.stats
. binom.rvs(p = 0.5, size = 5, n = 3)
means that the probability of getting head is 50 %,p = 0.5
; the size of sample in experiment is 5,size = 5
; the number of trial is 3,n = 3
.- In the output we can see an array with five results for each coin with the number of successful trials for each coin.
Tarea
Your task here is almost the same as in the previous chapter, play with one coin!
Imagine that here you have a coin with a general probability of 50%. Follow this algorithm:
- Import the
binom
object fromscipy.stats
. - Conduct the experiment with
binom
object usingrvs()
function:- Set
p
parameter equal to0.5
. - Set
size
parameter equal to1
. - Set
n
parameter equal to5
.
- Set
Please note, you can comment on the line where np.random.seed()
was defined and "play with the coin" to receive various outputs.
Note
Explanation of the output : We were tossing one coin five times, and it only led to success in three cases.