找回密码
 注册
查看: 907|回复: 0

R语言 skellam包 Skellam()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 09:50:40 | 显示全部楼层 |阅读模式
Skellam(skellam)
Skellam()所属R语言包:skellam

                                        The Skellam Distribution
                                         Skellam分布

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Density, distribution function, quantile function and random number generation for the Skellam distribution with parameters lambda1 and lambda2. <br> If Y1 and Y2 are Poisson variables with means mu1 and mu2 and correlation rho, then X = Y1 - Y2 is Skellam with parameters lambda1 = mu1 - rho*sqrt(mu1*mu2) and lambda2 = mu2 - rho*sqrt(mu1*mu2).
密度,分布函数,分位数函数的参数lambda1和lambda2Skellam分布的随机数生成。 <br>如果Y1和Y2是泊松变量的手段mu1和mu2和相关rho,那么X = Y1 - Y2是Skellam与参数lambda1 = mu1 - rho*sqrt(mu1*mu2)和lambda2 = mu2 - rho*sqrt(mu1*mu2)。


用法----------Usage----------


dskellam(x, lambda1, lambda2 = lambda1, log = FALSE)
pskellam(q, lambda1, lambda2 = lambda1, lower.tail = TRUE, log.p = FALSE)
qskellam(p, lambda1, lambda2 = lambda1, lower.tail = TRUE, log.p = FALSE)
rskellam(n, lambda1, lambda2 = lambda1)
dskellam.sp(x, lambda1, lambda2 = lambda1, log = FALSE)
pskellam.sp(q, lambda1, lambda2 = lambda1, lower.tail = TRUE, log.p = FALSE)



参数----------Arguments----------

参数:x, q
vector of quantiles.
向量的位数。


参数:p
vector of probabilities.
向量的概率。


参数:n
number of observations. If length(n) > 1, the length is taken to be the number required.
若干意见。如果length(n) > 1,长度所需的数量。


参数:lambda1, lambda2
vectors of (non-negative) means.
向量(非负的)的装置。


参数:log, log.p
logical; if TRUE, probabilities p are given as log(p).
逻辑,如果TRUE,给出概率为log(P)。


参数:lower.tail
logical; if TRUE (default), probabilities are P[X \le x], otherwise, P[X > x].
逻辑;如果TRUE(默认),概率是P[X \le x],否则,“P[X > x]。


Details

详细信息----------Details----------

dskellam returns a value equivalent to
dskellam返回一个值,相当于

pskellam(x,lambda1,lambda2) returns pchisq(2*lambda2, -2*x, 2*lambda1) for x<=0 and 1 - pchisq(2*lambda1, 2*(x+1), 2*lambda2) for x>=0. When pchisq incorrectly returns 0, a saddlepoint approximation is substituted, which typically gives at least 2-figure accuracy.
pskellam(x,lambda1,lambda2)返回pchisq(2*lambda2, -2*x, 2*lambda1)x<=0和1 - pchisq(2*lambda1, 2*(x+1), 2*lambda2)x>=0。当pchisq错误地返回0,鞍点近似被取代时,这通常提供至少2位数的精度。

The quantile is defined as the smallest value x such that F(x) \ge p, where F is the distribution function. For lower.tail=FALSE, the quantile is defined as the largest value x such that F(x,lower.tail=FALSE) \le p.
位数被定义为最小的值x等F(x) \ge p,其中F是分布函数。对于lower.tail=FALSE,位数被定义为最大的值x的,使得F(x,  lower.tail=FALSE  ) \le p。

rskellam is calculated as rpois(n,lambda1)-rpois(n,lambda2)
rskellamrpois(n,lambda1)-rpois(n,lambda2)计算的

dskellam.sp and pskellam.sp return saddlepoint approximations to the pmf and cdf. They are called by dskellam and pskellam when results from primary methods are in doubt.
dskellam.sp和pskellam.sp返回鞍点近似的pmf和cdf。他们被称为dskellam和pskellam结果的主要方法有任何疑问。


值----------Value----------

dskellam gives the (log) density, pskellam gives the (log) distribution function, qskellam gives the quantile function, and rskellam generates random deviates.  Invalid lambdas will result in return value NaN, with a warning.
dskellam给出了(log)密度,pskellam给出了分布函数(log),qskellam给分位数的功能,和rskellam随机产生的偏离。无效的lambda的返回值将导致NaN,一个警告。


注意----------Note----------

The VGAM package (http://lib.stat.cmu.edu/R/CRAN/web/packages/VGAM/index.html) also contains dskellam and rskellam functions, which are syntactically similar; independently developed versions are included here for completeness. Moreover, this dskellam function offers a broader working range, correct handling of cases where at least one rate parameter is zero, enhanced argument checking, and (in R versions prior to 2.9) improved accuracy for x<0. If both packages are loaded, get("dskellam",pos="package:skellam") or get("dskellam",pos="package:VGAM") can unambiguously specify which implementation to use.
VGAM的包(http://lib.stat.cmu.edu/R/CRAN/web/packages/VGAM/index.html)也包含dskellam和rskellam函数,在语法上是相似的,自主开发的版本都包括在这里的完整性。此外,这dskellam:功能提供了更广泛的工作范围,正确处理的情况下,其中至少有一个是零率参数,增强的参数检查,提高了精度(R版本2.9之前)在x <0。如果这两个包被加载,get("dskellam",pos="package:skellam")或get("dskellam",pos="package:VGAM")可以明确指定使用哪一个实现。


(作者)----------Author(s)----------


Jerry W. Lewis



源----------Source----------

The relation of dgamma to the modified Bessel function of the first kind was given by Skellam (1946). The relation of pgamma to the noncentral chi-square was given by Johnson (1959). Tables are given by Strackee and van der Gon (1962), which can be used to verify this implementation  (cf. direct calculation in the examples below).
第一类修正Bessel函数的关系dgamma是由Skellam(1946年)。约翰逊(1959年)的非中心卡方pgamma的关系。表给予Strackee和van der刚(1962),它可以使用,以验证此实施(参见下面的例子中直接计算)。

qskellam uses the Cornish&ndash;Fisher expansion to include skewness and kurtosis corrections to a normal approximation, followed by a search. If getOption("verbose")==TRUE, then qskellam will not use qpois when one of the lambdas is zero, in order to verify that this search algorithm has been implemented properly.
qskellam使用Cornish-Fisher展开,包括偏度和峰度修正到正常的逼近,紧跟搜索。如果getOption("verbose")==TRUE,然后qskellam不会使用qpois时其中的lambda的是零,为了验证,该搜索算法已被正确执行。


参考文献----------References----------

Butler, R. (2007) Saddlepoint Approximations with Applications, Cambridge University Press, Cambridge &amp; New York, p.17.
Johnson, N. L. (1959) On an extension of the connexion between Poisson and <code>chi^2</code> distributions. Biometrika 46, 352&ndash;362.
Johnson, N. L.; Kotz, S.; Kemp, A. W. (1993) Univariate Discrete Distributions, 2nd ed., John Wiley and Sons, New York, pp.190-192.
Skellam, J. G. (1946) The frequency distribution of the difference between two Poisson variates belonging to different populations. Journal of the Royal Statistical Society, series A 109/3, 26.
Strackee, J.; van der Gon, J. J. D. (1962) The frequency distribution of the difference between two Poisson variates. Statistica Neerlandica 16/1, 17-23.
Wikipedia. Skellam distribution http://en.wikipedia.org/wiki/Skellam_distribution

实例----------Examples----------


require(skellam)

# one lambda = 0 ~ Poisson[一个λ= 0~泊松]
dskellam(0:10,5,0)    # dpois(0:10,5)[dpois(0:10,5)]
dskellam(-(0:10),0,5) # dpois(0:10,5)[dpois(0:10,5)]
pskellam(0:10,5,0,lower.tail=TRUE)      # ppois(0:10,5,lower.tail=TRUE)[ppois(0:10,5,lower.tail = TRUE)]
pskellam(0:10,5,0,lower.tail=FALSE)     # ppois(0:10,5,lower.tail=FALSE)[ppois(0:10,5,lower.tail = FALSE)]
pskellam(-(0:10),0,5,lower.tail=FALSE)  # ppois(0:10-1,5,lower.tail=TRUE)[ppois(0:10-1,5,lower.tail = TRUE)]
pskellam(-(0:10),0,5,lower.tail=TRUE)   # ppois(0:10-1,5,lower.tail=FALSE)[ppois(0:10-1,5,lower.tail = FALSE)]

# both lambdas != 0 ~ convolution of Poissons[这两个lambda表达式!= 0~卷积泊松]
dskellam(1,0.5,0.75)  # sum(dpois(1+0:10,0.5)*dpois(0:10,0.75))[总和(dpois(1 +0:10,0.5)* dpois(0:10,0.75))]
pskellam(1,0.5,0.75)  # sum(dskellam(-10:1,0.5,0.75))[SUM(dskellam(-10:1,0.5,0.75))]
dskellam(c(-1,1),c(12,10),c(10,12))  # c(0.0697968,0.0697968)[C(0.0697968,0.0697968)]
dskellam(c(-1,1),c(12,10),c(10,12),log=TRUE)  # log(dskellam(c(-1,1),c(12,10),c(10,12)))[log(dskellam(C(-1,1),C(12,10),C(10,12)))]
dskellam(256,257,1)  # 0.024829348733183769  # exact result for comparison with saddlepoint[0.024829348733183769#精确的结果比较鞍]
dskellam(-3724,2000,3000)  # 3.1058145363400105e-308  # exact result for comparison with saddlepoint (still accurate in extreme tail)[3.1058145363400105e-308#精确的结果进行比较与鞍点(在极端的尾巴仍然是准确的)]
pskellam(c(-1,0),c(12,10),c(10,12))  # c(0.2965079,0.7034921)[C(0.2965079,0.7034921)]
pskellam(c(-1,0),c(12,10),c(10,12),lower.tail=FALSE)  # 1-pskellam(c(-1,0),c(12,10),c(10,12))[1 pskellam(C(-1,0),C(12,10),C(10,12))]
pskellam(-2:2,8.5,10.25,log.p=TRUE)  # log(pskellam(-2:2,8.5,10.25))[log(pskellam(-2:2,8.5,10.25))]
qskellam(c(0.05,0.95),3,4)  # c(-5,3); pskellam(cbind(-6:-5,2:3),3,4)[C(-5,3); pskellam(CBIND(跌:-5,2:3),3,4)]
qskellam(c(0.05,0.95),3,0)  # c(1,6); qpois(c(0.05,0.95),3)[。(1,6); qpois(三(0.05,0.95),3)]
rskellam(35,8.5,10.25)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-26 02:19 , Processed in 0.024376 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表