Menghitung probabilitas penarikan jumlah keberhasilan tertentu [atau jumlah keberhasilan maksimum] dalam jumlah percobaan tertentu, dengan mempertimbangkan populasi berukuran tertentu yang berisi jumlah keberhasilan tertentu, dengan penggantian tarikan.Contoh Penggunaan
BINOMDIST [4,100,0.005, FALSE]
BINOMDIST [A2, A3, A4, TRUE]
Sintaksis
BINOMDIST[jumlah_keberhasilan, jumlah_percobaan, probabilitas_keberhasilan, kumulatif]
jumlah_keberhasilan
- Jumlah
keberhasilan untuk menghitung probabilitas dalam percobaan jumlah_percobaan.kumulatif
adalah TRUE, maka BINOMDIST akan menampilkan probabilitas jumlah_keberhasilan atau lebih sedikit keberhasilan; jika tidak, menampilkan probabilitas keberhasilan jumlah_keberhasilan yang pasti.jumlah_percoban
- Jumlah percobaan independen.probabilitas_keberhasilan
- Probabilitas keberhasilan dalam percobaan yang diberikan.kumulatif
- [ FALSE secara
default ] - Apakah akan menggunakan distribusi kumulatif binomial atau tidak.Catatan
HYPGEOMDIST
menjelaskan probabilitas penarikan jumlah keberhasilan tertentu dalam jumlah percobaan tertentu, dengan mempertimbangkan populasi berukuran tertentu yang berisi jumlah keberhasilan tertentu, tanpa penggantian penarikan.Lihat Juga
WEIBULL
: Menampilkan
nilai fungsi distribusi Weibull [atau fungsi distribusi kumulatif Weibull] untuk bentuk dan skala yang ditentukan.PROB
: Dengan mempertimbangkan kumpulan nilai dan probabilitas yang sesuai, menghitung probabilitas bahwa nilai yang dipilih secara acak berada di antara dua batas.POISSON
: Menampilkan nilai dari fungsi distribusi
Poisson [atau fungsi distribusi kumulatif Poisson] untuk nilai dan rerata yang ditentukan.NORMSINV
: Menampilkan nilai fungsi distribusi normal baku terbalik untuk nilai yang ditentukan.NORMSDIST
: Menampilkan nilai fungsi distribusi kumulatif normal baku untuk nilai yang ditentukan.NORMINV
: Menampilkan nilai fungsi distribusi normal terbalik untuk nilai, rerata, dan simpangan baku yang ditentukan.NORMDIST
: Fungsi NORMDIST menampilkan nilai fungsi distribusi normal [atau fungsi distribusi kumulatif normal] untuk nilai, rataan, dan simpangan baku yang ditentukan.NEGBINOMDIST
: Menghitung probabilitas penarikan sejumlah kegagalan tertentu sebelum sejumlah keberhasilan tertentu, dengan mempertimbangkan probabilitas keberhasilan dalam percobaan independen.LOGNORMDIST
: Menampilkan nilai distribusi kumulatif log-normal dengan rerata dan simpangan baku yang diberikan pada nilai yang ditentukan.LOGINV
: Menampilkan nilai distribusi kumulatif log-normal terbalik dengan rerata dan simpangan baku yang diberikan pada nilai yang ditentukan.HYPGEOMDIST
: Menghitung probabilitas penarikan jumlah keberhasilan tertentu dalam jumlah percobaan tertentu, dengan mempertimbangkan populasi berukuran tertentu yang berisi jumlah keberhasilan
tertentu, tanpa penggantian tarikan.
EXPONDIST
: Menampilkan nilai fungsi distribusi eksponensial dengan lambda yang ditentukan pada nilai tertentu.
CRITBINOM
: Menghitung nilai terkecil yang distribusi binomial kumulatifnya lebih besar dari atau sama dengan kriteria yang ditentukan.
Contoh
Apakah ini membantu?
Bagaimana cara meningkatkannya?
Statistik Dasar untuk Data Scientist — Part 2: Probability Distribution
Jika kalian belum membaca bagian pertama series ini, silakan kunjungi link ini untuk membacanya, sebab dasar dari apa yang saya bahas di artikel ini akan merujuk kepada dasar-dasar statistik yang ada di artikel tersebut.
Pada artikel ini saya akan mencoba menjelaskan konsep dari Probability Distribution. Konsep ini penting untuk dipahami oleh…
Binomial distribution is a probability distribution that summarises the likelihood that a variable will take one of two independent values under a given set of parameters. The distribution is obtained by performing a number of Bernoulli trials.
A Bernoulli trial is assumed to meet each of these criteria :
- There must be only 2 possible outcomes.
- Each outcome has a fixed probability of occurring. A success has the probability of p, and a failure has the probability of 1 – p.
- Each trial is completely independent of all others.
The binomial random variable represents the number of successes[r] in n successive independent trials of a Bernoulli experiment.
Probability of achieving r success and n-r failure is :
The number of ways we can achieve r successes is :
Hence, the probability mass function[pmf], which is the total probability of achieving r success and n-r failure is :
An example illustrating the distribution :
Consider a random experiment of tossing a biased coin 6 times where the probability of getting a head is 0.6. If ‘getting a head’ is considered as ‘success’ then, the binomial distribution table will contain the probability of r successes for each possible value of r.
r | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
P[r] | 0.004096 | 0.036864 | 0.138240 | 0.276480 | 0.311040 | 0.186624 | 0.046656 |
This distribution has a mean equal to np and a variance of np[1-p].
Using Python to obtain the distribution :
Now, we will use Python to analyse the distribution[using SciPy] and plot the graph[using Matplotlib].
Modules required :
- SciPy:
SciPy is an Open Source Python library, used in mathematics, engineering, scientific and technical computing.Installation :
pip install scipy
- Matplotlib:
Matplotlib is a comprehensive Python library for plotting static and interactive graphs and visualisations.Installation :
pip install matplotlib
The scipy.stats module contains various functions for statistical calculations and tests. The stats[] function of the scipy.stats.binom module can be used to calculate a binomial distribution using the values of n and p.
Syntax : scipy.stats.binom.stats[n, p]
It returns a tuple containing the mean and variance of the distribution in that order.
scipy.stats.binom.pmf[] function is used to obtain the probability mass function for a certain value of r, n and p. We can obtain the distribution by passing all possible values of r[0 to n].
Syntax : scipy.stats.binom.pmf[r, n, p]
Calculating distribution table :
Approach :
- Define n and p.
- Define a list of values of r from 0 to n.
- Get mean and variance.
- For each r, calculate the pmf and store in a list.
Code :
from
scipy.stats
import
binom
n
=
6
p
=
0.6
r_values
=
list
[
range
[n
+
1
]]
mean, var
=
binom.stats[n, p]
dist
=
[binom.pmf[r, n, p]
for
r
in
r_values ]
print
[
"r\tp[r]"
]
for
i
in
range
[n
+
1
]:
print
[
str
[r_values[i]]
+
"\t"
+
str
[dist[i]]]
print
[
"mean = "
+
str
[mean]]
print
[
"variance = "
+
str
[var]]
Output :
r p[r] 0 0.004096000000000002 1 0.03686400000000005 2 0.13824000000000003 3 0.2764800000000001 4 0.31104 5 0.18662400000000007 6 0.04665599999999999 mean = 3.5999999999999996 variance = 1.44
Code: Plotting the graph using matplotlib.pyplot.bar[] function to plot vertical bars.
from
scipy.stats
import
binom
import
matplotlib.pyplot as plt
n
=
6
p
=
0.6
r_values
=
list
[
range
[n
+
1
]]
dist
=
[binom.pmf[r, n, p]
for
r
in
r_values ]
plt.bar[r_values, dist]
plt.show[]
Output :
When success and failure are equally likely, the binomial distribution is a normal distribution. Hence, changing the value of p to 0.5, we obtain this graph, which is identical to a normal distribution plot :