R语言学统计【医学统计学 第四版】

统计学第六章 几种离散变量的分布及其应用

2017-10-02  本文已影响51人  x2yline

知识清单

1. 二项分布

二项分布(binomial distribution),是指只有两种可能结果的n此独立重复实验中,出现阳性次数X的一种概论分布

1.1 适用条件

1.2 性质

> # 单侧检验(优于0.55)p值计算
> # 即仅计算上图中右尾部分,为sum(P(X>=9))
> size = 10  # 独立重复试验次数
> prob = 0.55  # 每次成功的概率
> test_x = 9  # 实际成功次数
> x_range <- seq(0, size, by=1)
> p_range <- dbinom(prob=prob, size=size, x=x_range)
> p_value <- sum(p_range[x_range>=size])
> p_value
[1] 0.002532952
> # 双侧p值计算
> # 计算上图中左尾和右尾概率之和,sum(P(X=i)) where P(X=i) <= P(X=9))
> size = 10  # 独立重复试验次数
> prob = 0.55  # 每次成功的概率
> test_x = 9  # 实际成功次数
> x_range <- seq(0, size, by=1)
> p_range <- dbinom(prob=prob, size=size, x=x_range)
> p_value <- sum(p_range[p_range<=p_range[x_range==test_x]])
> p_value
[1] 0.02775935
正态近似法

条件:n较大,p和1-p均不太小,np和n(1-p)均大于5,二项分布可近似正态分布,其u值计算公式为

2.3 Poisson分布的应用

2.3.1 总体均数的区间估计
查表法(X<=50)

例:1立升空气测得粉尘粒子数为21,估计改车间平均每立升空气粉尘颗粒的95%和99%可信区间

> exactci::poisson.exact(21, plot=T, conf.level=0.95)

    Exact two-sided Poisson test (central method)

data:  21 time base: 1
number of events = 21, time base = 1, p-value < 2.2e-16
alternative hypothesis: true event rate is not equal to 1
95 percent confidence interval:
 12.99933 32.10073
sample estimates:
event rate 
        21 

> exactci::poisson.exact(21, plot=T, conf.level=0.99)

    Exact two-sided Poisson test (central method)

data:  21 time base: 1
number of events = 21, time base = 1, p-value < 2.2e-16
alternative hypothesis: true event rate is not equal to 1
99 percent confidence interval:
 11.06923 35.94628
sample estimates:
event rate 
        21 

> poisson.test(20, alternative="two.sided", conf.level=0.95)

    Exact Poisson test

data:  20 time base: 1
number of events = 20, time base = 1, p-value < 2.2e-16
alternative hypothesis: true event rate is not equal to 1
95 percent confidence interval:
 12.21652 30.88838
sample estimates:
event rate 
        20 

> poisson.test(20, alternative="two.sided", conf.level=0.99)

    Exact Poisson test

data:  20 time base: 1
number of events = 20, time base = 1, p-value < 2.2e-16
alternative hypothesis: true event rate is not equal to 1
99 percent confidence interval:
 10.35327 34.66800
sample estimates:
event rate 
        20 

参考:
https://artax.karlin.mff.cuni.cz/r-help/library/exactci/html/poisson.exact.html

近似正态法(X>50)

计算1-alpha的可信区间可以近似为:


正态近似法(lambda>=20),u的计算公式为:



来源:
http://www.math.wm.edu/~leemis/chart/UDR/UDR.html

推荐阅读:
http://mp.weixin.qq.com/s/OPVxygrrEsLT3gHc-ccx9Q

上一篇下一篇

猜你喜欢

热点阅读