当前位置:文档之家› matlab概率统计

matlab概率统计


8.1.2.7 F 分布
其为参数p,q的函数,且p,q均为正整数。
• 例:分别绘制(p,q)为(1,1),(2,1),(3,1)(3,2),(4,1)时F 分布的概率密度函数与分布函数曲线。
>> x=[-eps:-0.02:-0.5,0:0.02:1]; x=sort(x'); >> p1=[1 2 3 3 4]; q1=[1 1 1 2 1]; y1=[]; y2=[]; >> for i=1:length(p1) y1=[y1,fpdf(x,p1(i),q1(i))]; y2=[y2,fcdf(x,p1(i),q1(i))]; end >> plot(x,y1), figure; plot(x,y2)
Distribution Beta Distribution Binomial Distribution
Chi-Square Distribution Exponential Distribution Extreme Value Distribution Gamma Distribution Generalized Extreme Value
8.1.2.6 Rayleigh分布
• 例:
>> x=[-eps:-0.02:-0.5,0:0.02:5]; x=sort(x'); >> b1=[.5,1,3,5]; y1=[]; y2=[]; >> for i=1:length(b1) y1=[y1,raylpdf(x,b1(i))]; y2=[y2,raylcdf(x,b1(i))]; end >> plot(x,y1), figure; plot(x,y2)
8.1.2.4
分布(卡方分布)
其为一特殊的
分布 ,a=k/2, l =1/2。
• 例:
>> x=[-eps:-0.02:-0.5,0:0.02:2]; x=sort(x'); >> k1=[1,2,3,4,5]; y1=[]; y2=[]; >> for i=1:length(k1) y1=[y1,chi2pdf(x,k1(i))]; y2=[y2,chi2cdf(x,k1(i))];end >> plot(x,y1), figure; plot(x,y2)
name 'beta' or 'Beta' 'bino' or 'Binomial'
'chi2' or 'Chisquare' 'exp' or 'Exponential' 'ev' or 'Extreme Value' 'gam' or 'Gamma' 'gev' or 'Generalized 'gp' or 'Generalized Pareto' 'geo' or 'Geometric' 'hyge' or 'Hypergeometric'
Uniform Distribution (Discrete) N: maximum observable Weibull Distribution a: scale parameter
• 例: 计算正态分布N(0,1)的随机变量X在点 0.6578的密度函数值。 • 解: >> pdf('norm',0.6578,0,1) • ans = • 0.3213
8.1.2.5
概率密度函数为:
分布
其为参数k的函数,且k为正整数。
• 例:
>> x=[-5:0.02:5]'; k1=[1,2,5,10]; y1=[]; y2=[]; >> for i=1:length(k1) y1=[y1,tpdf(x,k1(i))]; y2=[y2,tcdf(x,k1(i))]; end >> plot(x,y1), figure; plot(x,y2)
ν1: numerator degrees
ν: degrees of freedom ν: degrees of freedom μ: mean λ: mean b: scale parameter ν: degrees of freedom a: lower endpoint
ν2: denominator degrees
8.1.2.2 正态分布
正态分布的概率密度函数为:
• 例:
>> x=[-5:.02:5]'; y1=[]; y2=[]; >> mu1=[-1,0,0,0,1]; sig1=[1,0.1,1,10,1]; sig1=sqrt(sig1); >> for i=1:length(mu1) y1=[y1,normpdf(x,mu1(i),sig1(i))]; y2=[y2,normcdf(x,mu1(i),sig1(i))]; end >> plot(x,y1), figure; plot(x,y2)
例: 求标准正态分布随机变量X落在区间(-∞, 0.4)内的概率。 解:>> cdf('norm',0.4,0,1) ans = 0.6554
例:求自由度为16的卡方分布随机变量落在[0, 6.91]内的概率。 解:>> cdf('chi2',6.91,16) ans = 0.0250
随机变量的逆累积分布函数 MATLAB中的逆累积分布函数是已知,求x。 命令 icdf 计算逆累积分布函数 格式 icdf(‘name’,K,A) icdf(‘name’,K,A,B) icdf(‘name’,K,A,B,C) 说明 返回分布为name,参数为a1,a2,a3,累 积概率值为P的临界值,这里name与前面相同。 如果F= cdf(‘name’,X,A,B,C) , 则 X = icdf(‘name’,F,A,B,C)
• 例:自由度为8的卡方分布,在点2.18处的密度函数 值。 • 解: >> pdf('chi2',2.18,8) • ans = • 0.0363
随机变量的累积概率值(分布函数值) 通用函数cdf用来计算随机变量的概率之和 (累积概率值) 函数 cdf 格式 cdf(‘name’,K,A) cdf(‘name’,K,A,B) cdf(‘name’,K,A,B,C) 说明 返回以name为分布、随机变量X≤K的概率 之和的累积概率值,name为分布函数名.
— — — — μ: location parameteห้องสมุดไป่ตู้ μ: threshold (location) — n: number of samples — —
Generalized Pareto Distribution k: tail index (shape) Geometric Distribution Hypergeometric Distribution p: probability parameter M: size of the population
8.1.2 常见分布的概率密度函数与分布函数
8.1.2.1 Poisson分布
其要求x是正整数。
其中:x为选定的一组横坐标向量, y为x各点处的概率密度函数值。
• 例:绘制 l =1,2,5,10 时 Poisson 分布的概率密 度函数与概率分布函数曲线。
>> x=[0:15]'; y1=[]; y2=[]; lam1=[1,2,5,10]; >> for i=1:length(lam1) y1=[y1,poisspdf(x,lam1(i))]; y2=[y2,poisscdf(x,lam1(i))]; end >> plot(x,y1), figure; plot(x,y2)
8.1.3 概率问题的求解
图4-9
• 例:
>> b=1; p1=raylcdf(0.2,b); p2=raylcdf(2,b); P1=p2-p1 P1 = 0.8449
>> p1=raylcdf(1,b); P2=1-p1 P2 = 0.6065
'nct' or 'Noncentral t' 'ncx2' 'norm' or 'Normal' 'poiss' or 'Poisson' 'rayl' or 'Rayleigh' 't' or 'T' 'unif' or 'Uniform' 'unid' or 'Discrete Uniform' 'wbl' or 'Weibull'
'logn' or 'Lognormal' Lognormal Distribution μ 'nbin' or 'Negative Binomial' Negative Binomial Distribution r: number of successes
'ncf' or 'Noncentral F'
Noncentral F Distribution
Noncentral t Distribution Noncentral Chi-Square Normal Distribution Poisson Distribution Rayleigh Distribution Student's t Distribution Uniform Distribution
相关主题