Binomial Distribution

AI, Data Science, and Statistics

Statistics and Machine Learning Toolbox

Probability Distributions -> Discrete Distributions -> Binomial Distribution

Bernoulli Distribution

The Bernoulli distribution is a discrete probability distribution with only two possible values for the random variable.

Binomial Distribution

The binomial distribution models the total number of successes in repeated trials from an infinite population under certain conditions.

ON THIS PAGE

Overview

Parameters

Probability Density Function

Cumulative Distribution Function

Descriptive Statistics

Example

Related Distributions

References

See Also

Related Topics

Main Content

Binomial Distribution

Overview

The binomial distribution is a two-parameter family of curves.

The binomial distribution is used to model the total number of successes in a fixed number of independent trials that have the same probability of success,

such as modeling the probability of a given number of heads in ten flips of a fair coin.

Statistics and Machine Learning Toolbox offers several ways to work with the binomial distribution.

Create a probability distribution object BinomialDistribution by fitting a probability distribution to sample data (fitdist) or by specifying parameter values (makedist). Then, use object functions to evaluate the distribution, generate random numbers, and so on.

Work with the binomial distribution interactively by using the Distribution Fitter app. You can export an object from the app and use the object functions.

Use distribution-specific functions (binocdf, binopdf, binoinv, binostat, binofit, binornd) with specified distribution parameters. The distribution-specific functions can accept parameters of multiple binomial distributions.

Use generic distribution functions (cdf, icdf, pdf, random) with a specified distribution name ('Binomial') and parameters.

Parameters

The binomial distribution uses the following parameters.

Parameter Description Support

N Number of trials Positive integer

p Probability of success in a single trial 0≤p≤1

The sum of two binomial random variables that both have the same parameter p is also a binomial random variable with N equal to the sum of the number of trials.

Probability Density Function

The probability density function (pdf) of the binomial distribution is

f(x∣N,p)=(

N

x

)p

x

(1−p)

N−x

 ; x=0,1,2,...,N ,

where x is the number of successes in N trials of a Bernoulli process with the probability of success p. The result is the probability of exactly x successes in N trials. For discrete distributions, the pdf is also known as the probability mass function (pmf).

For an example, see Compute Binomial Distribution pdf.

Cumulative Distribution Function

The cumulative distribution function (cdf) of the binomial distribution is

F(x∣N,p)=

x



i=0

(

N

i

)p

i

(1−p)

N−i

 ; x=0,1,2,...,N ,

where x is the number of successes in N trials of a Bernoulli process with the probability of success p. The result is the probability of at most x successes in N trials.

For an example, see Compute Binomial Distribution cdf.

Descriptive Statistics

The mean of the binomial distribution is Np.

The variance of the binomial distribution is Np(1 – p).

Example

Fit Binomial Distribution to Data

Generate a binomial random number that counts the number of successes in 100 trials with the probability of success 0.9 in each trial.

x = binornd(100,0.9)

x = 85

Fit a binomial distribution to data using fitdist.

pd = fitdist(x,'Binomial','NTrials',100)

pd =

BinomialDistribution

Binomial distribution

N = 100

p = 0.85 [0.764692, 0.913546]

fitdist returns a BinomialDistribution object. The interval next to p is the 95% confidence interval estimating p.

Estimate the parameter p using the distribution functions.

[phat,pci] = binofit(x,100) % Distribution-specific function

phat = 0.8500

pci = 1×2

0.7647    0.9135

[phat2,pci2] = mle(x,'distribution','Binomial',"NTrials",100) % Generic distribution function

phat2 = 0.8500

pci2 = 2×1

0.7647
0.9135

Compute Binomial Distribution pdf

Compute the pdf of the binomial distribution with 10 trials and the probability of success 0.5.

x = 0:10;

y = binopdf(x,10,0.5);

Plot the pdf with bars of width 1.

figure

bar(x,y,1)

xlabel('Observation')

ylabel('Probability')

Compute Binomial Distribution cdf

Compute the cdf of the binomial distribution with 10 trials and the probability of success 0.5.

x = 0:10;

y = binocdf(x,10,0.5);

Plot the cdf.

figure

stairs(x,y)

xlabel('Observation')

ylabel('Cumulative Probability')

Compare Binomial and Normal Distribution pdfs

When N is large, the binomial distribution with parameters N and p can be approximated by the normal distribution with mean Np and variance Np*(1–p) provided that p is not too large or too small.

Compute the pdf of the binomial distribution counting the number of successes in 50 trials with the probability 0.6 in a single trial .

N = 50;

p = 0.6;

x1 = 0:N;

y1 = binopdf(x1,N,p);

Compute the pdf of the corresponding normal distribution.

mu = Np;

sigma = sqrt(N
p*(1-p));

x2 = 0:0.1:N;

y2 = normpdf(x2,mu,sigma

SciTech-Mathematics-Probability+Statistics-Discrete Binomial Distribution: 离散二项式分布的更多相关文章

  1. 基本概率分布Basic Concept of Probability Distributions 1: Binomial Distribution

    PDF下载链接 PMF If the random variable $X$ follows the binomial distribution with parameters $n$ and $p$ ...

  2. negative binomial(Pascal) distribution —— 负二项式分布(帕斯卡分布)

    1. 定义 假设一串独立的伯努利实验(0-1,成功失败,伯努利实验),每次实验(trial)成功和失败的概率分别是 p 和 1−p.实验将会一直重复下去,直到实验失败了 r 次.定义全部实验中成功的次 ...

  3. Statistics : Data Distribution

    1.Normal distribution In probability theory, the normal (or Gaussian or Gauss or Laplace–Gauss) dist ...

  4. 基本概率分布Basic Concept of Probability Distributions 5: Hypergemometric Distribution

    PDF version PMF Suppose that a sample of size $n$ is to be chosen randomly (without replacement) fro ...

  5. Fuzzy Probability Theory---(3)Discrete Random Variables

    We start with the fuzzy binomial. Then we discuss the fuzzy Poisson probability mass function. Fuzzy ...

  6. 【概率论】5-5:负二项分布(The Negative Binomial Distribution)

    title: [概率论]5-5:负二项分布(The Negative Binomial Distribution) categories: - Mathematic - Probability key ...

  7. The zero inflated negative binomial distribution

    The zero-inflated negative binomial – Crack distribution: some properties and parameter estimation Z ...

  8. 基本概率分布Basic Concept of Probability Distributions 4: Negative Binomial Distribution

    PDF version PMF Suppose there is a sequence of independent Bernoulli trials, each trial having two p ...

  9. 基本概率分布Basic Concept of Probability Distributions 2: Poisson Distribution

    PDF version PMF A discrete random variable $X$ is said to have a Poisson distribution with parameter ...

  10. 基本概率分布Basic Concept of Probability Distributions 8: Normal Distribution

    PDF version PDF & CDF The probability density function is $$f(x; \mu, \sigma) = {1\over\sqrt{2\p ...

随机推荐

  1. 基于Cherry Studio + DeepSeek 搭建本地私有知识库!

    在当今数字化时代,知识管理变得越来越重要.无论是个人还是企业,都希望能够高效地存储.管理和检索知识.而借助 AI 技术,我们可以实现更加智能的知识库系统.本文将详细介绍如何使用 Cherry Stud ...

  2. netcore限流

    netcore限流 using System; using System.Collections.Generic; using System.Threading.Tasks; using Micros ...

  3. LinqHelper拓展

    public static class LinqHelper { //NHibernate.Hql.Ast.HqlBooleanExpression public static Expression& ...

  4. BootStrap CDN收藏,矢量图标

    <!-- 新 Bootstrap 核心 CSS 文件 --> <link href="https://cdn.staticfile.org/twitter-bootstra ...

  5. 鸿蒙版《智慧农业APP》通过华为云IoT平台实现软件硬件互联

    一.原理图 本篇不涉及硬件相关的功能开发,硬件设备使用MQTT客户端模拟,如果有硬件相关经验的可以直接使用真实硬件代替MQTT客户端. 1.华为云物联网服务器 华为云物联网平台是硬件设备端跟移动APP ...

  6. BS直聘职位数据采集与分析(爬虫)

    一.项目介绍 在当今竞争激烈的就业市场中,及时掌握职位信息和市场动态变得尤为重要.本文将详细介绍如何使用Python开发一个爬虫项目,自动采集BOSS直聘网站的职位数据,并对数据进行处理和分析. 1. ...

  7. WebSocket 实时通信(二)

    WebSocket 即时消息推送系统 1. 项目概述 1.1 项目背景 在现代 Web 应用中,实时通信功能越来越重要,例如在线聊天.实时通知.股票行情更新等.本项目基于 WebSocket 技术,构 ...

  8. 转|java反射方法和使用

    概述   java中不通过new关键字获取对象并且使用类对象中的成员变量和方法,第一时间我们会想到可以使用反射去实现这些功能.反射很强大,而且是Spring的常用轮子,故我们学会了它就可以搭配很多东西 ...

  9. Spring注解之@Autowired自动装配bean 综述

    @Autowired的工作原理是什么?在启动spring IoC时,容器自动装载了一个AutowiredAnnotationBeanPostProcessor后置处理器,当容器扫描到@Autowire ...

  10. QEMU安装巨大的坑

    网上教程大多数让你 sudo apt install qemu 实际上根本没用!!!! 查了一下debian官网 结果 QEMU is a fast processor emulator. Once ...