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

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

[复制链接]
发表于 2012-10-1 15:50:33 | 显示全部楼层 |阅读模式
Qvar(VGAM)
Qvar()所属R语言包:VGAM

                                         Quasi-variances Preprocessing Function
                                         准差异预处理功能

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

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

Takes a vglm fit or a variance-covariance matrix, and preprocesses it for rcam and normal1 so that quasi-variances can be computed.
注意到一个vglm合适的方差 - 协方差矩阵,并进行预处理rcam和normal1所以,准方差,可以计算。


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


Qvar(object, factorname = NULL, coef.indices = NULL, labels = NULL,
     dispersion = NULL, reference.name = "(reference)", estimates = NULL)



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

参数:object
A "vglm" object or a variance-covariance matrix, e.g., vcov(vglm.object). The former is preferred since it contains all the information needed. If a matrix then factorname and/or coef.indices should be specified to identify the factor.   
A"vglm"对象或方差 - 协方差矩阵,例如,vcov(vglm.object)。前者是首选,因为它包含了所有需要的信息。如果一个矩阵,然后factorname和/或coef.indices应指定确定的因素。


参数:factorname
Character. If the vglm object contains more than one factor as explanatory variable then this argument should be the name of the factor of interest. If object is a variance-covariance matrix then this argument should also be specified.   
字符。如果vglm对象包含一个以上的因素作为解释变量,则此参数的名称应该是利益的因素。如果object是方差 - 协方差矩阵,那么也可以指定此参数应。


参数:labels
Character. Optional, for labelling the variance-covariance matrix.   
字符。选购,标签方差 - 协方差矩阵。


参数:dispersion
Numeric. Optional, passed into vcov() with the same argument name.   
数字。可选,通过vcov()使用相同的参数名称。


参数:reference.name
Character. Label for for the reference level.   
字符。出版商的参考电平。


参数:coef.indices
Optional numeric vector of length at least 3 specifying the indices of the factor from the variance-covariance matrix.  
可选数值向量的长度至少为3的方差 - 协方差矩阵的因子从指定的索引。


参数:estimates
an optional vector of estimated coefficients (redundant if object is a model).  
一个可选的估计系数向量的(冗余object如果是一个模型)。


Details

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

Suppose a factor with L levels is an explanatory variable in a regression model. By default, R treats the first level as baseline so that its coefficient is set to zero. It estimates the other L-1 coefficients, and with its associated standard errors, this is the conventional output. From the complete variance-covariance matrix one can compute L quasi-variances based on all pairwise difference of the coefficients. They are based on an approximation, and can be treated as uncorrelated. In minimizing the relative (not absolute) errors it is not hard to see that the estimation involves a RCAM (rcam) with an exponential link function (explink).
假设L水平的一个因素是一个回归模型的解释变量。缺省情况下,R将第一电平作为基准,所以,它的系数被设置为零。据估计其他L-1系数,和与它相关联的标准误差,这是传统的输出。从完整的方差 - 协方差矩阵的一个可以计算L准所有成对系数的差异的基础上的方差。它们是基于一个近似值,并且可以被视为不相关。在减少相对(不是绝对的)错误,也不是很难看,这个估计涉及到一个RCAM的指数链接功能(rcam)(explink)。

If object is a model, then at least one of factorname or coef.indices must be non-NULL. The value of coef.indices, if non-NULL, determines which rows and columns of the model's variance-covariance matrix to use. If coef.indices contains a zero, an extra row and column are included at the indicated position, to represent the zero variances and covariances associated with a reference level. If coef.indices is NULL, then factorname should be the name of a factor effect in the model, and is used in order to extract the necessary variance-covariance estimates.
如果object是一个模型,然后,至少一个factorname或coef.indices必须非NULL。的价值coef.indices,如果非NULL,确定模型的方差 - 协方差矩阵的行和列的。如果coef.indices包含零,一个额外的行和列,在指定的位置,代表零的方差和协方差与参考电平。 coef.indices如果是NULL,那么factorname的名称在模型中的一个因素影响,并用于以提取必要的方差 - 协方差估计。

Quasi-variances were first implemented in R with qvcalc. This implementation draws heavily from that.
准的差异,首次实现在R qvcalc。此实现大量借鉴。


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

A L by L matrix whose i-j element is the logarithm of the variance of the ith coefficient minus the jth coefficient, for all values of i and j. The diagonal elements are abitrary and are set to zero.
ALL矩阵的i - j元素的i个系数的方差的对数减去j个系数的,所有值i和j。的对角线元素是abitrary被设置为零。

The matrix has an attribute that corresponds to the prior weight matrix; it is accessed by normal1 and replaces the usual weights argument. of vglm. This weight matrix has ones on the off-diagonals and some small positive number on the diagonals.
该矩阵有一个属性,对应于现有的权重矩阵,它是访问normal1和取代通常的weights参数。 vglm。权重矩阵的对角线上的对角线和一些小的正数。


警告----------Warning ----------

Negative quasi-variances may occur (one of them and only one), though they are rare in practice. If so then numerical problems may occur. See qvcalc() for more information.
负半的差异,可能会出现(其中一个和唯一的一个),但他们在实践中是罕见的。如果是这样,那么数值可能会出现问题。见qvcalc()更多信息。


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

This is an adaptation of qvcalc() in qvcalc. It should work for all vglm models with one linear predictor, i.e., M = 1. For M > 1 the factor should appear only in one of the linear predictors.
这是一个qvcalc()适应qvcalc。它应该工作的所有vglm模型的线性预测,也就是说,M = 1。对于M > 1的因素应该只出现在其中的线性预测。

It is important to set maxit to be larger than usual for rcam since convergence is slow. Upon successful convergence the ith row effect and the ith column effect should be equal. A simple computation involving the fitted and predicted values allows the quasi-variances to be extracted (see example below).
重要的是要设置maxit比平常大rcam自收敛比较慢。成功融合后的i日行效果和i列的效果应该是平等的。一个简单的计算涉及安装和预测值允许被提取的准差异(见下面的例子)。

A function to plot comparison intervals has not been written here.
还没有在这里写一个函数来绘制比较的时间间隔。


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



T. W. Yee, based heavily on <code>qvcalc()</code> in <span class="pkg">qvcalc</span>
written by David Firth.




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

Overcoming the reference category problem in the presentation of statistical models. Sociological Methodology 33, 1&ndash;18.
Quasi-variances. Biometrika 91, 65&ndash;80.

参见----------See Also----------

rcam, vglm, normal1, explink, qvcalc() in qvcalc, ships.
rcam,vglm,normal1,explink,qvcalc()中qvcalc,ships。


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


data("ships", package = "MASS")

Shipmodel <- vglm(incidents ~ type + year + period,
                  quasipoissonff, offset = log(service),
#                 trace = TRUE, model = TRUE,[跟踪= TRUE,模型= TRUE,]
                  data = ships, subset = (service > 0))

# Easiest form of input[最简单的形式输入]
fit1 <- rcam(Qvar(Shipmodel, "type"), normal1("explink"), maxit = 99)
(quasiVar &lt;- exp(diag(fitted(fit1))) / 2)                 # Version 1[版本1]
(quasiVar &lt;- diag(predict(fit1)[, c(TRUE, FALSE)]) / 2)   # Version 2[第2版]
(quasiSE  <- sqrt(quasiVar))

# Another form of input[另一种形式的输入]
fit2 <- rcam(Qvar(Shipmodel, coef.ind = c(0,2:5), reference.name = "typeA"),
             normal1("explink"), maxit = 99)
## Not run:  plotqvar(fit2, col = "orange", lwd = 3, scol = "blue", slwd = 2, las = 1) [#不运行:plotqvar(FIT2,山口=“橙色”,随钻测井= 3,SCOL =“蓝”,SLWD = 2,LAS = 1)]

# The variance-covariance matrix is another form of input (not recommended)[方差 - 协方差矩阵是另一种形式的输入(不推荐)]
fit3 <- rcam(Qvar(cbind(0, rbind(0, vcov(Shipmodel)[2:5, 2:5])),
                  labels = c("typeA", "typeB", "typeC", "typeD", "typeE"),
                  estimates = c(typeA = 0, coef(Shipmodel)[2:5])),
             normal1("explink"), maxit = 99)
(QuasiVar &lt;- exp(diag(fitted(fit3))) / 2)                 # Version 1[版本1]
(QuasiVar &lt;- diag(predict(fit3)[, c(TRUE, FALSE)]) / 2)   # Version 2[第2版]
(QuasiSE  <- sqrt(quasiVar))
## Not run:  plotqvar(fit3) [#不运行:plotqvar(FIT3)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 14:47 , Processed in 0.032805 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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