nbcanlink(VGAM)
nbcanlink()所属R语言包:VGAM
Negative binomial canonical link function
负二项分布规范链接功能
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes the negative binomial canonical link transformation, including its inverse and the first two derivatives.
计算负二项分布规范链接的改造,包括逆和前两个衍生物。
用法----------Usage----------
nbcanlink(theta, earg = list(), inverse = FALSE, deriv = 0,
short = TRUE, tag = FALSE)
参数----------Arguments----------
参数:theta
Numeric or character. Typically the mean of a negative binomial (NB) distribution. See below for further details.
数字或字符。通常情况下,负二项式(NB)分布的平均值。请参阅下面进一步的细节。
参数:earg
List. Extra argument for passing in additional information. Here, a size component contains the k matrix which must be of a conformable dimension as theta. Also, if deriv > 0 then a wrt.eta component which is either 1 or 2 (1 for with respect to the first linear predictor, and 2 for with respect to the second linear predictor (a function of k)).
列表。额外的信息传递额外的参数。这里,一个size成分含有k矩阵必须是保形的维度theta。此外,如果deriv > 0然后wrt.eta组分,它是1或2(1相对于到第一线性预测,和2相对于第二线性预测器(的函数的<X >))。
参数:inverse
Logical. If TRUE the inverse function is computed.
逻辑。如果TRUE的逆函数计算。
参数:deriv
Order of the derivative. Integer with value 0, 1 or 2.
订购的衍生工具。值0,1或2的整数,带。
参数:short
Used for labelling the blurb slot of a vglmff-class object.
用于标签blurb插槽的vglmff-class对象。
参数:tag
Used for labelling the linear/additive predictor in the initialize slot of a vglmff-class object. Contains a little more information if TRUE.
用于标注线性/对添加剂的预测在initialize插槽的vglmff-class对象。如果TRUE包含了一些信息。
Details
详细信息----------Details----------
The negative binomial (NB) canonical link is log(theta/(theta + k)) where theta is the mean of a NB distribution. The canonical link is used for theoretically relating the NB to GLM class.
负二项分布(NB)规范链接是log(theta/(theta + k))其中theta是一个NB的平均分布。规范的链路被用于理论上相关的NB GLM类。
This link function was specifically written for negbinomial and negbinomial.size, and should not be used elsewhere (these VGAM family functions have code that specifically handles nbcanlink().)
此链接功能是专门写的negbinomial和negbinomial.size,不应该用在其他地方(这些VGAM的家庭功能有代码专门处理nbcanlink()。)
值----------Value----------
For deriv = 0, the above equation when inverse = FALSE, and if inverse = TRUE then kmatrix / expm1(-theta). For deriv = 1, then the function returns d theta / d eta as a function of theta if inverse = FALSE, else if inverse = TRUE then it returns the reciprocal.
对于deriv = 0,上面的等式,当inverse = FALSE,并如果inverse = TRUEkmatrix / expm1(-theta)的。对于deriv = 1,则该函数返回Dtheta / Deta的函数,theta如果inverse = FALSE如果inverse = TRUE然后它返回的倒数。
警告----------Warning----------
This function currently does not work very well with negbinomial! The NB-C model is sensitive to the initial values and may converge to a local solution. Pages 210 and 309 of Hilbe (2011) notes convergence difficulties (of Newton-Raphson type algorithms), and this applies here. This function should work okay with negbinomial.size. Currently trying something like imethod = 3 or imu, stepsize = 0.5, maxit = 100, zero = -2 should help; see the example below.
该功能目前并没有很好地工作与negbinomial! NB-C模型的初始值是敏感的,可能收敛到一个本地的解决方案。第210和309页的Hilbe(2011)指出的收敛困难(牛顿 - 拉夫逊型算法),这适用于这里。此功能与negbinomial.size应该没问题。目前正在尝试的东西,如imethod = 3或imu,stepsize = 0.5,maxit = 100,zero = -2应该帮助,请参阅下面的例子。
注意----------Note----------
While theoretically nice, this function is not recommended in general since its value is always negative (linear predictors ought to be unbounded in general). A loge link for argument lmu is recommended instead.
虽然理论上是不错的,不推荐使用此功能一般,因为它的值是负(线性预测应该是无界的,一般)。 Aloge链接为参数lmu建议。
Numerical instability may occur when theta is close to 0 or 1. For the earg argument, values of theta which are less than or equal to 0 can be replaced by the bvalue component of the list earg before computing the link function value. The component name bvalue stands for “boundary value”. See Links for general information about earg.
theta是接近0或1的数值不稳定,可能会出现。对于earg参数,theta的值是小于或等于0时,可以代替由bvalue组件的列表earg计算链接函数值之前。组件名称bvalue的意思是“边界值”。见Links的一般信息,关于earg。
(作者)----------Author(s)----------
Thomas W. Yee
参考文献----------References----------
Two-parameter reduced-rank vector generalized linear models. In preparation.
Negative Binomial Regression, 2nd Edition. Cambridge: Cambridge University Press.
参见----------See Also----------
negbinomial, negbinomial.size.
negbinomial,negbinomial.size。
实例----------Examples----------
nbcanlink("mu", short = FALSE)
mymu = 1:10 # Test some basic operations:[测试的一些基本操作:]
kmatrix = matrix(runif(length(mymu)), length(mymu), 1)
eta1 = nbcanlink(mymu, earg = list(size = kmatrix))
ans2 = nbcanlink(eta1, earg = list(size = kmatrix), inverse = TRUE)
max(abs(ans2 - mymu)) # Should be 0[应为0]
## Not run: mymu = c(seq(0.5, 10, length = 101))[#不运行:mymu = C(SEQ(0.5,10,长度= 101))]
kmatrix = matrix(10, length(mymu), 1)
plot(nbcanlink(mymu, earg = list(size = kmatrix)) ~ mymu, las = 1,
type = "l", col = "blue", lwd = 1.5, xlab = expression({mu}))
## End(Not run)[#(不执行)]
# Estimate the parameters from some simulated data (see Warning section)[估计参数从一些模拟数据(见警语部分)]
set.seed(123)
ndata <- data.frame(x2 = runif(nn <- 1000 ))
size1 = exp(1); size2 = exp(2)
ndata <- transform(ndata, eta1 = -1 - 2 * x2, # eta1 < 0[ETA1 <0]
size1 = size1,
size2 = size2)
ndata <- transform(ndata,
mu1 = nbcanlink(eta1, earg = list(size = size1), inv = TRUE),
mu2 = nbcanlink(eta1, earg = list(size = size2), inv = TRUE))
ndata <- transform(ndata, y1 = rnbinom(nn, mu = mu1, size = size1),
y2 = rnbinom(nn, mu = mu2, size = size2))
head(ndata)
summary(ndata)
fit <- vglm(cbind(y1, y2) ~ x2, negbinomial("nbcanlink", imethod = 3),
stepsize = 0.5, ndata, # Deliberately slow the convergence rate[故意放慢了收敛速度]
maxit = 100, trace = TRUE) # Warning: may converge to a local soln[警告:可能会收敛到本地SOLN]
coef(fit, matrix = TRUE)
summary(fit)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|