betabinomial.ab(VGAM)
betabinomial.ab()所属R语言包:VGAM
Beta-binomial Distribution Family Function
β-二项分布的家庭功能
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Fits a beta-binomial distribution by maximum likelihood estimation. The two parameters here are the shape parameters of the underlying beta distribution.
适用于β-二项分布的最大似然估计。这里的两个参数是底层beta分布的形状参数。
用法----------Usage----------
betabinomial.ab(lshape12 = "loge", earg = list(), i1 = 1, i2 = NULL,
imethod = 1, shrinkage.init = 0.95, nsimEIM = NULL,
zero = NULL)
参数----------Arguments----------
参数:lshape12
Link function applied to both (positive) shape parameters of the beta distribution. See Links for more choices.
链接功能适用于两个(正)的Beta分布的形状参数。见Links更多的选择。
参数:earg
List. Extra argument for the link. See earg in Links for general information.
列表。额外的参数的链接。见earg中Links的一般信息。
参数:i1, i2
Initial value for the shape parameters. The first must be positive, and is recyled to the necessary length. The second is optional. If a failure to converge occurs, try assigning a different value to i1 and/or using i2.
形状参数的初始值。第一个必须是阳性的,和被recyled必要的长度。第二个是可选的。如果收敛失败时,尝试分配一个不同的值i1和/或使用i2。
参数:zero
An integer specifying which linear/additive predictor is to be modelled as an intercept only. If assigned, the single value should be either 1 or 2. The default is to model both shape parameters as functions of the covariates. If a failure to converge occurs, try zero = 2.
一个整数,指定线性/添加剂的预测中是被定义成仅截距。如果分配的,单值应该是1或2。默认值是两个形状参数模型的协变量的函数。如果收敛失败时,试着去zero = 2。
参数:shrinkage.init, nsimEIM, imethod
See CommonVGAMffArguments for more information. The argument shrinkage.init is used only if imethod = 2. Using the argument nsimEIM may offer large advantages for large values of N and/or large data sets.
见CommonVGAMffArguments更多信息。使用的参数shrinkage.init只有imethod = 2。使用参数nsimEIM可以提供大的优势,为大N和/或大型数据集的值。
Details
详细信息----------Details----------
There are several parameterizations of the beta-binomial distribution. This family function directly models the two shape parameters of the associated beta distribution rather than the probability of success (however, see Note below). The model can be written T|P=p ~ Binomial(N,p) where P has a beta distribution with shape parameters alpha and beta. Here, N is the number of trials (e.g., litter size), T=NY is the number of successes, and p is the probability of a success (e.g., a malformation). That is, Y is the proportion of successes. Like binomialff, the fitted values are the estimated probability of success (i.e., E[Y] and not E[T]) and the prior weights N are attached separately on the object in a slot.
有几个参数化的β-二项分布。这间家庭功能直接建模的两个形状参数相关联的beta分布,而不是成功的概率(但是,请参阅下面的“注”)。该模型可以书面T|P=p ~ Binomial(N,p)其中P有β分布形状参数alpha和beta。在这里,N是试验次数(例如,产仔数),T=NY是成功的次数,和p是一个成功的概率(例如,一个畸形)。也就是说,Y是成功的比例。喜欢binomialff,拟合值的估计的成功概率(即,E[Y]而不是E[T])和现有的权重N附着在对象上分开一个时隙中。
The probability function is
概率函数是
where t=0,1,…,N, and B is the beta function with shape parameters alpha and beta. Recall Y = T/N is the real response being modelled.
t=0,1,…,N和B是β函数的形状参数alpha和beta。回忆Y = T/N是真正的响应被建模。
The default model is eta1 = log(alpha) and eta2 = log(beta) because both parameters are positive. The mean (of Y) is p = mu = alpha / (alpha + beta) and the variance (of Y) is mu(1-mu)(1+(N-1)rho)/N. Here, the correlation rho is given by 1/(1 + alpha + beta) and is the correlation between the N individuals within a litter. A litter effect is typically reflected by a positive value of rho. It is known as the over-dispersion parameter.
默认的模式是eta1 = log(alpha)和eta2 = log(beta),因为这两个参数是积极的。平均(Y)p = mu = alpha / (alpha + beta)和方差(Y)mu(1-mu)(1+(N-1)rho)/N。 ,相关rho的1/(1 + alpha + beta)是的N内的枯枝落叶的个人之间的相关性。一胎效果典型地反映为正值的rho。这是被称为过度分散参数。
This family function uses Fisher scoring. The two diagonal elements of the second-order expected derivatives with respect to alpha and beta are computed numerically, which may fail for large alpha, beta, N or else take a long time.
此的家庭功能使用费舍尔得分。这两个对角线元素的的二阶预期的衍生工具相对于alpha和beta是数值计算,但可能无法为大alpha,beta,N否则需要很长的时间。
值----------Value----------
An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm.
类的一个对象"vglmff"(见vglmff-class)。该对象被用于建模功能如vglm。
Suppose fit is a fitted beta-binomial model. Then fit@y (better: depvar(fit)) contains the sample proportions y, fitted(fit) returns estimates of E(Y), and weights(fit, type = "prior") returns the number of trials N.
假设fit是一个装有β-二项式模型。然后fit@y(更好:depvar(fit))中包含的样本比例y,fitted(fit)E(Y)和weights(fit, type = "prior")返回的试验次数的回报率估计N。
警告----------Warning ----------
This family function is prone to numerical difficulties due to the expected information matrices not being positive-definite or ill-conditioned over some regions of the parameter space. If problems occur try setting i1 to be some other positive value, using i2 and/or setting zero = 2.
这间家庭功能很容易由于预期的信息矩阵是正定的或病态的,在一些区域的参数空间的数值困难。如果问题发生尝试设置i1是其他一些积极的价值,以i2和/或设置zero = 2。
This family function may be renamed in the future. See the warnings in betabinomial.
这间家庭功能可能在未来被重新命名。见的警告betabinomial。
注意----------Note----------
This function processes the input in the same way as binomialff. But it does not handle the case N=1 very well because there are two parameters to estimate, not one, for each row of the input. Cases where N=1 can be omitted via the subset argument of vglm.
此函数处理的输入相同的方式binomialff。但它不处理的情况下N=1非常好,因为有两个参数估计,而不是一个,每行的输入。其中N=1可以通过subset的vglm参数省略的情况。
Although the two linear/additive predictors given above are in terms of alpha and beta, basic algebra shows that the default amounts to fitting a logit link to the probability of success; subtracting the second linear/additive predictor from the first gives that logistic regression linear/additive predictor. That is, logit(p) = eta1 - eta2. This is illustated in one of the examples below.
虽然两个线性/添加剂上面给出的预测因子是在alpha和beta,基本代数显示默认的嵌合一个logit链接到成功的概率;减去第二线性/添加剂预测器第一,logistic回归线性/添加剂的预测。也就是说logit(p) = eta1 - eta2。这是在下面的实施例中的其中一个illustated。
The extended beta-binomial distribution of Prentice (1986) is currently not implemented in the VGAM package as it has range-restrictions for the correlation parameter that are currently too difficult to handle in this package.
普伦蒂斯(1986)扩展的β-二项分布目前尚未实现在VGAM包,因为它有范围限制的相关参数,目前也很难处理这个包。
(作者)----------Author(s)----------
T. W. Yee
参考文献----------References----------
Robust estimation of the variance in moment methods for extra-binomial and extra-Poisson variation. Biometrics, 47, 383–401.
Binary regression using an extended beta-binomial distribution, with discussion of correlation induced by covariate measurement errors. Journal of the American Statistical Association, 81, 321–327.
参见----------See Also----------
betabinomial, Betabinom, binomialff, betaff, dirmultinomial, lirat.
betabinomial,Betabinom,binomialff,betaff,dirmultinomial,lirat。
实例----------Examples----------
# Example 1[例1]
N = 10; s1 = exp(1); s2 = exp(2)
y = rbetabinom.ab(n = 100, size = N, shape1 = s1, shape2 = s2)
fit = vglm(cbind(y, N-y) ~ 1, betabinomial.ab, trace = TRUE)
coef(fit, matrix = TRUE)
Coef(fit)
head(fit@misc$rho) # The correlation parameter[相关参数]
head(cbind(depvar(fit), weights(fit, type = "prior")))
# Example 2[例2]
fit = vglm(cbind(R, N-R) ~ 1, betabinomial.ab, data = lirat,
trace = TRUE, subset = N > 1)
coef(fit, matrix = TRUE)
Coef(fit)
fit@misc$rho # The correlation parameter[相关参数]
t(fitted(fit))
t(depvar(fit))
t(weights(fit, type = "prior"))
# A "loge" link for the 2 shape parameters is a logistic regression:[A“包厢”链接的2个形状参数是一个logistic回归分析:]
all.equal(c(fitted(fit)),
as.vector(logit(predict(fit)[, 1] -
predict(fit)[, 2], inverse = TRUE)))
# Example 3, which is more complicated[实施例3中,这是更复杂的]
lirat = transform(lirat, fgrp = factor(grp))
summary(lirat) # Only 5 litters in group 3[第3组只有5窝]
fit2 = vglm(cbind(R, N-R) ~ fgrp + hb, betabinomial.ab(zero = 2),
data = lirat, trace = TRUE, subset = N > 1)
coef(fit2, matrix = TRUE)
coef(fit2, matrix = TRUE)[, 1] -
coef(fit2, matrix = TRUE)[, 2] # logit(p)[罗吉(P)]
## Not run: with(lirat, plot(hb[N > 1], fit2@misc$rho,[#不运行:(lirat,图(HB [N> 1],FIT2万方$ RHO,]
xlab = "Hemoglobin", ylab = "Estimated rho",
pch = as.character(grp[N > 1]), col = grp[N > 1]))
## End(Not run)[#(不执行)]
## Not run: # cf. Figure 3 of Moore and Tsiatis (1991)[#不运行:#比照。图3 Moore和Tsiatis的(1991)]
with(lirat, plot(hb, R / N, pch = as.character(grp), col = grp, las = 1,
xlab = "Hemoglobin level", ylab = "Proportion Dead",
main = "Fitted values (lines)"))
smalldf = with(lirat, lirat[N > 1, ])
for(gp in 1:4) {
xx = with(smalldf, hb[grp == gp])
yy = with(smalldf, fitted(fit2)[grp == gp])
ooo = order(xx)
lines(xx[ooo], yy[ooo], col = gp) }
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|