Binom2.or(VGAM)
Binom2.or()所属R语言包:VGAM
Bivariate Binary Regression with an Odds Ratio
二元二元回归,其比值比
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Density and random generation for a bivariate binary regression model using an odds ratio as the measure of dependency.
密度和随机生成的二元二元回归模型的比值比作为衡量的依赖。
用法----------Usage----------
rbinom2.or(n, mu1,
mu2 = if(exchangeable) mu1 else stop("argument 'mu2' not specified"),
oratio = 1, exchangeable = FALSE, tol = 0.001, twoCols = TRUE,
colnames = if(twoCols) c("y1","y2") else c("00", "01", "10", "11"),
ErrorCheck = TRUE)
dbinom2.or(mu1,
mu2 = if(exchangeable) mu1 else stop("'mu2' not specified"),
oratio = 1, exchangeable = FALSE, tol = 0.001,
colnames = c("00", "01", "10", "11"), ErrorCheck = TRUE)
参数----------Arguments----------
参数:n
number of observations. Must be a single positive integer. The arguments mu1, mu2, oratio are recycled to length n.
若干意见。必须是一个单一的正整数。的参数mu1,mu2,oratio被回收长度n。
参数:mu1, mu2
The marginal probabilities. Only mu1 is needed if exchangeable = TRUE. Values should be between 0 and 1.
边缘概率。只有mu1如果exchangeable = TRUE。值应该是在0和1之间。
参数:oratio
Odds ratio. Must be numeric and positive. The default value of unity means the responses are statistically independent.
赔率比。必须是数字和积极的。统一的默认值表示的反应是统计独立的。
参数:exchangeable
Logical. If TRUE, the two marginal probabilities are constrained to be equal.
逻辑。如果TRUE,这两个边缘概率的约束是平等的。
参数:twoCols
Logical. If TRUE, then a n * 2 matrix of 1s and 0s is returned. If FALSE, then a n * 4 matrix of 1s and 0s is returned.
逻辑。如果TRUE,然后是n*2矩阵1s和0s返回。如果FALSE,然后是n*4矩阵1s和0s返回。
参数:colnames
The dimnames argument of matrix is assigned list(NULL, colnames).
dimnamesmatrix参数分配list(NULL, colnames)。
参数:tol
Tolerance for testing independence. Should be some small positive numerical value.
测试独立的公差。应该有一些小的正数值。
参数:ErrorCheck
Logical. Do some error checking of the input parameters?
逻辑。做一些错误的输入参数的检查?
Details
详细信息----------Details----------
The function rbinom2.or generates data coming from a bivariate binary response model. The data might be fitted with the VGAM family function binom2.or.
的功能rbinom2.or产生的数据来自一个二元二元响应模型。的数据可能会被安装与VGAM家庭函数binom2.or。
The function dbinom2.or does not really compute the density (because that does not make sense here) but rather returns the four joint probabilities.
的功能dbinom2.or并没有真正计算密度(因为这是没有意义的),而是返回四个联合概率。
值----------Value----------
The function rbinom2.or returns either a 2 or 4 column matrix of 1s and 0s, depending on the argument twoCols.
函数rbinom2.or返回1s和0s 2或4列的矩阵,根据参数twoCols。
The function dbinom2.or returns a 4 column matrix of joint probabilities; each row adds up to unity.
函数dbinom2.or的联合概率返回一个4列的矩阵,每行统一。
(作者)----------Author(s)----------
T. W. Yee
参见----------See Also----------
binom2.or.
binom2.or。
实例----------Examples----------
# Example 1[例1]
nn = 2000
ymat = rbinom2.or(n = nn, mu1 = 0.8, oratio = exp(2), exch = TRUE)
(mytab = table(ymat[,1], ymat[,2], dnn=c("Y1", "Y2")))
(myor = mytab["0","0"] * mytab["1","1"] / (mytab["1","0"] * mytab["0","1"]))
fit = vglm(ymat ~ 1, binom2.or(exch = TRUE))
coef(fit, matrix = TRUE)
# Example 2[例2]
x = sort(runif(nn))
mu1 = logit(-2+4*x, inv = TRUE)
mu2 = logit(-1+3*x, inv = TRUE)
dmat = dbinom2.or(mu1 = mu1, mu2 = mu2, oratio = exp(2))
ymat = rbinom2.or(n = nn, mu1 = mu1, mu2 = mu2, oratio = exp(2))
fit2 = vglm(ymat ~ x, binom2.or)
coef(fit2, matrix = TRUE)
## Not run: [#不运行:]
matplot(x, dmat, lty = 1:4, col = 1:4, type = "l",
main = "Joint probabilities", ylim = 0:1, lwd = 2)
legend(x = 0, y = 0.5, lty = 1:4, col = 1:4, lwd = 2,
legend = c("1 = (y1=0, y2=0)", "2 = (y1=0, y2=1)",
"3 = (y1=1, y2=0)", "4 = (y1=1, y2=1)"))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|