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

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

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

                                         Control function for vglm
                                         控制为vglm的功能

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

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

Algorithmic constants and parameters for running vglm are set using this function.
算法的常量和运行参数vglm使用此功能。


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


vglm.control(checkwz = TRUE, criterion = names(.min.criterion.VGAM),
             epsilon = 1e-07, half.stepsizing = TRUE,
             maxit = 30, nowarning = FALSE,
             stepsize = 1, save.weight = FALSE,
             trace = FALSE, wzepsilon = .Machine$double.eps^0.75,
             xij = NULL, ...)



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

参数:checkwz
logical indicating whether the diagonal elements of the working weight matrices should be checked whether they are sufficiently positive, i.e., greater than wzepsilon. If not, any values less than wzepsilon are replaced with this value.  
逻辑指示的工作的权重矩阵的对角线元素是否应检查是否有足够的正面,即,大于wzepsilon。如果没有,任何值小于wzepsilon这个值被替换。


参数:criterion
character variable describing what criterion is to be used to test for convergence. The possibilities are listed in .min.criterion.VGAM, but most family functions only implement a few of these.  
字符变量描述被用来测试收敛准则是什么。列出了几种可能在.min.criterion.VGAM,但大多数家庭功能只实现了其中的一些。


参数:epsilon
positive convergence tolerance epsilon. Roughly speaking, the Newton-Raphson/Fisher-scoring iterations are assumed to have converged when two successive criterion values are within epsilon of each other.  
积极收敛性小量。大体来说,Newton-Raphson/Fisher-scoring的迭代就被认为融合时,两个连续的criterion值在epsilon彼此。


参数:half.stepsizing
logical indicating if half-stepsizing is allowed. For example, in maximizing a log-likelihood, if the next iteration has a log-likelihood that is less than the current value of the log-likelihood, then a half step will be taken.  If the log-likelihood is still less than at the current position, a quarter-step will be taken etc. Eventually a step will be taken so that an improvement is made to the convergence criterion.  half.stepsizing is ignored if criterion == "coefficients".  
逻辑,表示,如果半stepsizing允许。例如,在对数似然最大化,如果下一次迭代的具有对数似然是小于对数似然的当前值,然后半步骤将采取。如果对数似然仍然是小于在当前位置,四分之一步将采取等最终将采取的步骤,使一个改进的收敛准则作出。 half.stepsizing被忽略,如果criterion == "coefficients"。


参数:maxit
maximum number of (usually Fisher-scoring) iterations allowed. Sometimes Newton-Raphson is used.  
允许的最大数量(通常是费舍尔得分)迭代。有时候,牛顿 - 拉夫逊。


参数:nowarning
logical indicating whether to suppress a warning if convergence is not obtained within maxit iterations. This is ignored if maxit = 1 is set.  
逻辑指示是否抑制警告,如果不收敛内获得maxit迭代。这将被忽略,如果maxit = 1设置。


参数:stepsize
usual step size to be taken between each Newton-Raphson/Fisher-scoring iteration. It should be a value between 0 and 1, where a value of unity corresponds to an ordinary step.  A value of 0.5 means half-steps are taken.  Setting a value near zero will cause convergence to be generally slow but may help increase the chances of successful convergence for some family functions.  
通常的步长大小要采取彼此之间Newton-Raphson/Fisher-scoring迭代。它应该是0和1的方法,其中的统一的值对应于一个普通的步骤之间的一个值。值0.5表示一半步骤。设定值接近零,将导致收敛普遍较慢,但可以帮助一些家庭功能,提高成功融合的机会。


参数:save.weight
logical indicating whether the weights slot of a "vglm" object will be saved on the object. If not, it will be reconstructed when needed, e.g., summary. Some family functions have save.weight = TRUE and others have save.weight = FALSE in their control functions.  
逻辑是否weights插槽的"vglm"对象将被保存的对象。如果没有,它会被重建需要的时候,例如,summary。有些家庭功能save.weight = TRUE和save.weight = FALSE在他们的控制功能。


参数:trace
logical indicating if output should be produced for each iteration.  Setting trace = TRUE is recommended in general because VGAM fits a very broad variety of models and distributions, and for some of them, convergence is intrinsically more difficult. Monitoring convergence can help check that the solution is reasonable or that a problem has occurred.  It may suggest better initial values are needed, the making of invalid assumptions, or that the model is inappropriate for the data, etc.  
逻辑表明,如果输出应为每个迭代。设置trace = TRUE一般建议,因为“VGAM非常适合各种各样的模型和分布,对其中的一些,收敛本质上是更困难的。监控的收敛可以帮助检查,该解决方案是合理的,或发生了问题。它可能会建议需要更好的初始值,作出无效的假设,或,该模型是不合适内容的数据,等


参数:wzepsilon
small positive number used to test whether the diagonals of the working weight matrices are sufficiently positive.  
小的正数,用来测试是否有足够的积极的工作权值矩阵的对角线。


参数:xij
A formula or a list of formulas. Each formula has a RHS giving M terms making up a covariate-dependent term (whose name is the response). That is, it creates a variable that takes on different values for each linear/additive predictor, e.g., the ocular pressure of each eye. The M terms must be unique; use fill1, fill2, fill3, etc. if necessary. Each formula should have a response which is taken as the name of that variable, and the M terms are enumerated in sequential order. Each of the M terms multiply each successive row of the constraint matrix. When xij is used, the use of form2 is also required to give every term used by the model.  
一个公式或公式列表。每个公式有一个RHS在M条款的协变项(他的名字是响应)。也就是说,它创建了一个变量,它在不同的每个线性/添加剂预测,例如,每只眼睛的眼内压值。 M条款必须是唯一的,如果需要使用fill1,fill2,fill3,等。每个公式应该有一个响应,将其作为该变量的名称,和M术语列举的顺序。每个M条款的约束矩阵将每个连续行。当xij使用,使用form2还需要给每一个模型所使用的术语。


参数:...
other parameters that may be picked up from control functions that are specific to the VGAM family function.  
从特定的VGAM家庭功能的控制功能,其他参数可以拿起。


Details

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

Most of the control parameters are used within vglm.fit and you will have to look at that to understand the full details.
大多数的控制参数内使用vglm.fit,你必须了解的全部细节。

Setting save.weight = FALSE is useful for some models because the weights slot of the object is the largest and so less memory is used to store the object. However, for some VGAM family function, it is necessary to set save.weight = TRUE because the weights slot cannot be reconstructed later.
设置save.weight = FALSEweights插槽的对象是适用于某些型号的,因为是最大的,因此使用更少的内存来存储对象。然而,对于一些VGAM家庭功能,这是必要的设置save.weight = TRUE因为weights插槽不能重建。


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

A list with components matching the input names. A little error checking is done, but not much. The list is assigned to the control slot of vglm objects.
组件的列表匹配输入的名字。一个小的错误进行检查,但数量不多。该列表被分配到control插槽vglm对象。


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

Reiterating from above, setting trace = TRUE is recommended in general.
从上面重申,设置trace = TRUE建议一般。

In Example 2 below there are two covariates that have linear/additive predictor specific values. These are handled using the xij argument.
在下面的示例2中,有两个协变量线性/添加剂预测特定的值。这些xij使用参数处理。


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


Thomas W. Yee



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

Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.

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

vglm, fill. The author's homepage has further documentation about the xij argument.
vglm,fill。作者的主页上有进一步的xij参数文件。


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


# Example 1.[实施例1。]
pneumo = transform(pneumo, let = log(exposure.time))
vglm(cbind(normal, mild, severe) ~ let, multinomial, data = pneumo,
     crit = "coef", step = 0.5, trace = TRUE, eps = 1e-8, maxit = 40)


# Example 2. The use of the xij argument (simple case).[实施例2。的xij表示参数的使用(简单的情况下)。]
ymat = rdiric(n <- 1000, shape = rep(exp(2), len = 4))
mydat = data.frame(x1 = runif(n), x2 = runif(n), x3 = runif(n), x4 = runif(n),
                   z1 = runif(n), z2 = runif(n), z3 = runif(n), z4 = runif(n))
mydat = transform(mydat, X = x1, Z = z1)
mydat = round(mydat, dig = 2)
fit2 = vglm(ymat ~ X + Z,
            dirichlet(parallel = TRUE), data = mydat, trace = TRUE,
            xij = list(Z ~ z1 + z2 + z3 + z4,
                       X ~ x1 + x2 + x3 + x4),
            form2 = ~  Z + z1 + z2 + z3 + z4 +
                       X + x1 + x2 + x3 + x4)
head(model.matrix(fit2, type = "lm"))   # LM model matrix[LM模型矩阵]
head(model.matrix(fit2, type = "vlm"))  # Big VLM model matrix[大VLM模型矩阵]
coef(fit2)
coef(fit2, matrix = TRUE)
max(abs(predict(fit2)-predict(fit2, new = mydat))) # Predicts correctly[预测正确]
summary(fit2)
## Not run: [#不运行:]
# plotvgam(fit2, se = TRUE, xlab = "x1", which.term = 1) # Bug![plotvgam(FIT2,SE = TRUE,xlab =“X1”,which.term = 1)#问题!]
# plotvgam(fit2, se = TRUE, xlab = "z1", which.term = 2) # Bug![plotvgam(FIT2,SE = TRUE,xlab =“Z1”,which.term = 2)#问题!]
plotvgam(fit2, xlab = "x1") # Correct[更正]
plotvgam(fit2, xlab = "z1") # Correct[更正]

## End(Not run)[#(不执行)]


# Example 3. The use of the xij argument (complex case).[实施例3。的xij表示参数的使用(复杂的情况下)。]
set.seed(123)
coalminers = transform(coalminers,
                       Age = (age - 42) / 5,
                       dum1 = round(runif(nrow(coalminers)), dig = 2),
                       dum2 = round(runif(nrow(coalminers)), dig = 2),
                       dum3 = round(runif(nrow(coalminers)), dig = 2),
                       dumm = round(runif(nrow(coalminers)), dig = 2))
BS = function(x, ..., df = 3) bs(c(x,...), df = df)[1:length(x),,drop = FALSE]
NS = function(x, ..., df = 3) ns(c(x,...), df = df)[1:length(x),,drop = FALSE]

# Equivalently...[等价...]
BS = function(x, ..., df = 3) head(bs(c(x,...), df = df), length(x), drop = FALSE)
NS = function(x, ..., df = 3) head(ns(c(x,...), df = df), length(x), drop = FALSE)

fit3 = vglm(cbind(nBnW,nBW,BnW,BW) ~ Age + NS(dum1, dum2),
            fam = binom2.or(exchangeable = TRUE, zero = 3),
            xij = list(NS(dum1, dum2) ~ NS(dum1, dum2) +
                                        NS(dum2, dum1) +
                                        fill(NS( dum1))),
            form2 = ~  NS(dum1, dum2) + NS(dum2, dum1) + fill(NS(dum1)) +
                       dum1 + dum2 + dum3 + Age + age + dumm,
            data = coalminers, trace = TRUE)
head(model.matrix(fit3, type = "lm"))   # LM model matrix[LM模型矩阵]
head(model.matrix(fit3, type = "vlm"))  # Big VLM model matrix[大VLM模型矩阵]
coef(fit3)
coef(fit3, matrix = TRUE)
## Not run:  plotvgam(fit3, se = TRUE, lcol = "red", scol = "blue", xlab = "dum1") [#不运行:plotvgam(FIT3,SE = TRUE,LCOL =“红色”,SCOL =“蓝”,xlab =“dum1”)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 11:55 , Processed in 0.019876 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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