当前位置:网站首页>MCS:多元随机变量——多项式分布
MCS:多元随机变量——多项式分布
2022-06-29 14:39:00 【今晚打佬虎】
Multinomial多项式
假设一个实验有 k k k个相互独立的结果: R 1 , R 2 , . . . R k R_1, R_2, ... R_k R1,R2,...Rk对应发生的概率分别是: p 1 , p 2 , . . . p k p_1, p_2, ...p_k p1,p2,...pk。且 ∑ i = 1 k p i = 1.0 \sum_{i=1}^k p_i = 1.0 ∑i=1kpi=1.0。独立重复 n n n次实验,每一种实验结果发生的次数可以用随机变量 x 1 , x 2 , . . x k x_1, x_2, .. x_k x1,x2,..xk来表示, ∑ i = 1 k x i = n \sum_{i=1}^k x_i = n ∑i=1kxi=n。
x i x_i xi的概率分布:
P ( x 1 , . . . , x k ) = n ! [ x 1 ! . . . x k ! ] p 1 x 1 . . . p k x k P(x_1, ..., x_k) = \frac{n!}{[x_1!...x_k!]p_1^{x_1} ... p_k^{x_k}} P(x1,...,xk)=[x1!...xk!]p1x1...pkxkn!
x i x_i xi的边际(期望和方差):
E ( x i ) = n p i E(x_i) = np_i E(xi)=npi
V ( x i ) = n p i ( 1 − p i ) V(x_i) = np_i(1 - p_i) V(xi)=npi(1−pi)
生成多项式随机变量
已知:多显示变量: ( x 1 , x 2 , . . . , x k ) (x_1, x_2, ...,x_k) (x1,x2,...,xk),发生的概率: ( p 1 , P 2 , . . . p k ) (p_1, P_2, ...p_k) (p1,P2,...pk)
- i = 1 → k i = 1 \to k i=1→k
- p i ′ = p i / ∑ j = i k p j p_i' = p_i / \sum_{j=i}^k p_j pi′=pi/∑j=ikpj
- n i ′ = n − ∑ j = 1 i − 1 x j n_i' = n - \sum_{j=1}^{i-1} x_j ni′=n−∑j=1i−1xj
- 生成一个随机的二项式变量: x i ∼ B i n o m i a l ( n i ′ , p i ′ ) x_i \sim Binomial(n_i', p_i') xi∼Binomial(ni′,pi′)
- ( x 1 , x 2 , . . . x k ) (x1, x_2, ... x_k) (x1,x2,...xk)
例:假设一个实验只有三种结果可能发生,概率分别是:0.5, 0.3, 0.2。假设重复进行五次的独立实验,这种情况下每种情况出现的次数,即:随机的多项式变量: x 1 , x 2 , x 3 x_1, x_2, x_3 x1,x2,x3可能是多少?
- i = 1 , n 1 ′ = 5 , p 1 ′ = 0.5 , B i n o m i a l ( 5 , 0.5 ) = 2 , x 1 = 2 i = 1,n_1' = 5,p_1' = 0.5, Binomial(5, 0.5) = 2, x_1 = 2 i=1,n1′=5,p1′=0.5,Binomial(5,0.5)=2,x1=2
- i = 2 , n 2 ′ = 3 , p 2 ′ = 0.3 / ( 0.3 + 0.2 ) = 0.6 , B i n o m i a l ( 3 , 0.6 ) = 2 , x 2 = 2 i = 2, n_2' = 3,p_2' = 0.3/(0.3+0.2) = 0.6, Binomial(3, 0.6) = 2, x_2 = 2 i=2,n2′=3,p2′=0.3/(0.3+0.2)=0.6,Binomial(3,0.6)=2,x2=2
- i = 3 , n 3 ′ = 1 , p 3 ′ = 0.2 / 0.2 = 1.0 , B i n o m i a l ( 1 , 1.0 ) = 1 , x 3 = 1 i = 3, n_3' = 1, p_3' = 0.2/0.2 = 1.0, Binomial(1, 1.0) = 1, x_3 = 1 i=3,n3′=1,p3′=0.2/0.2=1.0,Binomial(1,1.0)=1,x3=1
- ( x 1 = 2 , x 2 = 2 , x 3 = 1 ) (x_1 = 2, x_2 = 2, x_3 = 1) (x1=2,x2=2,x3=1)
模拟生成多项式变量
import numpy as np
import matplotlib.pyplot as plt
def generateMultinomial(n = 100, k=3, probas=[0.5, 0.3, 0.2]):
x = [0, 0, 0]
for i in range(k):
p_ = probas[i]/np.sum(probas[i:])
n_ = n - np.sum(x[:i+1])
b = np.random.binomial(n_, p_)
x[i] = b
return x

边栏推荐
- How word automatically generates directories
- Weigao blood purification sprint to Hong Kong: annual revenue of RMB 2.9 billion, net profit decreased by 12.7%
- MySQL 数据库 - 通用语法 DDL DML DQL DCL
- Methods of accessing external services in istio grid
- Chapter 13 event operation of canvas
- synchronized 与多线程的哪些关系
- Kubernetes pod troubleshooting guide
- idea输出台输出中文乱码问题
- Is 100W data table faster than 1000W data table query in MySQL?
- June 27 talk SofiE
猜你喜欢

华理生物冲刺科创板:年营收2.26亿 拟募资8亿

MySQL 数据库 - 通用语法 DDL DML DQL DCL

二级指针

Methods of accessing external services in istio grid

synchronized 与多线程的哪些关系

Whitelabel error page access

精品商城拼团秒杀优惠折扣全功能完美双端自适应对接个人免签网站源码
![[Jenkins] pipeline controls the sequential execution of multiple jobs for timed continuous integration](/img/04/a650ab76397388bfb62d0dd190dbd0.png)
[Jenkins] pipeline controls the sequential execution of multiple jobs for timed continuous integration

EMC surge protection and decoupling design

Transport layer user datagram protocol (UDP)
随机推荐
Laravel - Composer 安装指定 Laravel 版本
Source code of campus secondary market
三角函数对应在平面坐标上画圆
华理生物冲刺科创板:年营收2.26亿 拟募资8亿
【Try to Hack】vulnhub DC2
熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
Trigonometric function corresponding to drawing circle on plane coordinate
Weigao blood purification sprint to Hong Kong: annual revenue of RMB 2.9 billion, net profit decreased by 12.7%
捷氢科技冲刺科创板:拟募资10.6亿 上汽集团是大股东
How does a two character name become a three character name with spaces
Evaluation index of high concurrency software (website, server interface)
Redis installation in windows and Linux Environment
wieshark抓包mysql协议简单分析
Whitelabel error page access
. Net program configuration file operation (INI, CFG, config)
类模板案例-【数组类封装】
You need to know about project procurement management
Asynchronous artifact completable future
URL encoding in Delphi7
Chinese garbled code output from idea output station