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

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

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

                                         Control function for QRR-VGLMs (CQO)
                                         控制功能QRR-VGLMs(CQO)

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

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

Algorithmic constants and parameters for a constrained quadratic ordination (CQO), by fitting a quadratic reduced-rank vector generalized linear model (QRR-VGLM), are set using this function. It is the control function for cqo.
(CQO)受约束的二次协调,通过拟合的二次降维的向量广义线性模型(QRR VGLM)的算法常数和参数设置,使用此功能。它的控制功能cqo。


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


qrrvglm.control(Rank = 1,
                Bestof = if(length(Cinit)) 1 else 10,
                checkwz = TRUE,
                Cinit = NULL,
                Crow1positive = TRUE,
                epsilon = 1.0e-06,
                EqualTolerances = TRUE,
                Etamat.colmax = 10,
                FastAlgorithm = TRUE,
                GradientFunction = TRUE,
                Hstep = 0.001,
                isdlv = rep(c(2, 1, rep(0.5, length = Rank)), length = Rank),
                iKvector = 0.1,
                iShape = 0.1,
                ITolerances = FALSE,
                maxitl = 40,
                imethod = 1,
                Maxit.optim = 250,
                MUXfactor = rep(7, length=Rank),
                Norrr = ~ 1,
                optim.maxit = 20,
                Parscale = if(ITolerances) 0.001 else 1.0,
                SD.Cinit = 0.02,
                SmallNo = 5.0e-13,
                trace = TRUE,
                Use.Init.Poisson.QO = TRUE,
                wzepsilon = .Machine$double.eps^0.75, ...)



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

参数:Rank
The numerical rank R of the model, i.e., the number of ordination axes. Must be an element from the set {1,2,...,min(M,p2)} where the vector of explanatory variables x is partitioned into (x_1,x_2), which is of dimension p1+p2. The variables making up x_1 are given by the terms in the Norrr argument, and the rest of the terms comprise x_2.  
数值秩R的模式,即协调轴的数量。必须是元素从集合{1,2,...,分(M,p2)},其中的解释变量的向量x划分为(x_1 ,x_2),这是的维度p1+p2。的变量x_1Norrr参数中的条款,其余的条款,包括x_2。


参数:Bestof
Integer. The best of Bestof models fitted is returned. This argument helps guard against local solutions by (hopefully) finding the global solution from many fits. The argument has value 1 if an initial value for C is inputted using Cinit.  
整数。 Bestof车型配备最好的返回。此参数有助于防止对本地解决方案(希望)发现许多适合全球性的解决方案。该参数的值为1,如果初始值C输入Cinit。


参数: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这个值被替换。


参数:Cinit
Optional initial C matrix, which must be a p2 by R matrix. The default is to apply .Init.Poisson.QO() to obtain initial values.  
可选的初始C矩阵,它必须是一个p2R矩阵。默认值是用.Init.Poisson.QO()获得初始值。


参数:Crow1positive
Logical vector of length Rank (recycled if necessary): are the elements of the first row of C positive? For example, if Rank is 4, then specifying Crow1positive=c(FALSE,       TRUE) will force C[1,1] and C[1,3] to be negative, and C[1,2] and C[1,4] to be positive. This argument allows for a reflection in the ordination axes because the coefficients of the latent variables are unique up to a sign.  
逻辑的矢量的长度Rank(再循环如果必要的话):是的第一行的元素C阳性?例如,如果Rank是4,那么Crow1positive=c(FALSE,       TRUE)将迫使C[1,1]和C[1,3]负,和C[1,2]和C[1,4]是的积极的。此参数允许在协调轴的反射,因为潜变量的系数是唯一的一个标志。


参数:epsilon
Positive numeric. Used to test for convergence for GLMs fitted in C. Larger values mean a loosening of the convergence criterion. If an error code of 3 is reported, try increasing this value.  
正数值。用于测试GLMS安装在C值越大,收敛的意思是松动的收敛准则。如果错误代码为3的报告,尝试增大该值。


参数:EqualTolerances
Logical indicating whether each (quadratic) predictor will have equal tolerances. Having EqualTolerances = TRUE can help avoid numerical problems, especially with binary data. Note that the estimated (common) tolerance matrix may or may not be positive-definite. If it is  then it can be scaled to the R by R identity matrix, i.e., made equivalent to ITolerances = TRUE. Setting ITolerances = TRUE will force a common R by R identity matrix as the tolerance matrix to the data even if it is not appropriate. In general, setting ITolerances = TRUE is preferred over EqualTolerances = TRUE because, if it works, it is much faster and uses less memory. However, ITolerances = TRUE requires the environmental variables to be scaled appropriately. See Details for more details.  
逻辑表明,是否每个(二次)的预测都享有平等的公差。 EqualTolerances = TRUE可以帮助避免数值的问题,特别是与二进制数据。请注意,估计的(共同)容许矩阵可能是或可能不是正定的。如果是,那么它可以扩展的RR身份矩阵,即,相当于ITolerances = TRUE的。设置ITolerances = TRUE将迫使一个共同的RR单位矩阵作为容许矩阵的数据,即使它是不适合的。在一般情况下,在ITolerances = TRUE优于EqualTolerances = TRUE因为,如果它的工作原理,它是速度更快,使用更少的内存。然而,ITolerances = TRUE需要适当的环境变量进行调整。更多详细信息,请参阅详细信息。


参数:Etamat.colmax
Positive integer, no smaller than Rank. Controls the amount of memory used by .Init.Poisson.QO(). It is the maximum number of columns allowed for the pseudo-response and its weights. In general, the larger the value, the better the initial value. Used only if Use.Init.Poisson.QO = TRUE.  
正整数,不小于Rank。控制使用的内存量的.Init.Poisson.QO()。是允许为伪响应及其权重的列的最大数目。在一般情况下,该值越大,更好的初始值。用只有Use.Init.Poisson.QO = TRUE。


参数:FastAlgorithm
Logical. Whether a new fast algorithm is to be used. The fast algorithm results in a large speed increases compared to Yee (2004). Some details of the fast algorithm are found in Appendix A of Yee (2006). Setting FastAlgorithm = FALSE will give an error.  
逻辑。无论是要使用一种新的快速算法。的快速算法相比,结果在一个大的速度增长怡(2004)。附录A议(2006年)被发现在一些细节的快速算法。设置FastAlgorithm = FALSE会给出一个错误。


参数:GradientFunction
Logical. Whether optim's argument gr is used or not, i.e., to compute gradient values. Used only if FastAlgorithm is TRUE. The default value is usually faster on most problems.   
逻辑。无论optim的说法gr使用与否,即,计算梯度值。使用,只有FastAlgorithm是TRUE。默认值通常是更快的大多数问题。


参数:Hstep
Positive value. Used as the step size in the finite difference approximation to the derivatives by optim.   
正值。作为步长的有限差分近似的衍生工具optim。


参数:isdlv
Initial standard deviations for the latent variables (site scores). Numeric, positive and of length R (recycled if necessary). This argument is used only if ITolerances = TRUE. Used by .Init.Poisson.QO() to obtain initial values for the constrained coefficients C adjusted to a reasonable value. It adjusts the spread of the site scores relative to a common species tolerance of 1 for each ordination axis. A value between 0.5 and 10 is recommended; a value such as 10 means that the range of the environmental space is very large relative to the niche width of the species. The successive values should decrease because the first ordination axis should have the most spread of site scores, followed by the second ordination axis, etc.   
最初的标准偏差的潜在变量(网站评分)。数字,积极长度R(回收如果必要的话)。这种说法是只有ITolerances = TRUE。使用的.Init.Poisson.QO()获得的初始值约束系数C调整到一个合理的值。它调整的部位相对于一个共同的种为每个协调轴公差为1的分数的蔓延。 0.5和10之间的一个值建议值,如10,表示相对于该物种的生态位宽度范围内的环境空间是非常大的。的连续值应该减少,因为第一排序轴应具有最蔓延站点分数,然后由所述第二排序轴等


参数:iKvector, iShape
Numeric, recycled to length S if necessary. Initial values used for estimating the positive k and lambda parameters of the negative binomial and 2-parameter gamma distributions respectively. For further information see negbinomial and gamma2. These arguments override the ik and ishape arguments in negbinomial and gamma2.   
数字,长度S,如果需要回收。的初始值,用于估计的正k和lambda负二项式参数和参数2  - 伽玛分布分别。欲了解更多信息,请参阅negbinomial和gamma2。这些参数将覆盖在ik和ishapenegbinomial和gamma2参数。


参数:ITolerances
Logical. If TRUE then the (common) tolerance matrix is the R by R identity matrix by definition. Note that having ITolerances = TRUE implies EqualTolerances = TRUE, but not vice versa. Internally, the quadratic terms will be treated as offsets (in GLM jargon) and so the models can potentially be fitted very efficiently. However, it is a very good idea to center  and scale all numerical variables in the x_2 vector. See Details for more details. The success of ITolerances = TRUE often depends on suitable values for isdlv and/or MUXfactor.  
逻辑。如果TRUE(普通)的耐受性矩阵是RR身份矩阵定义。需要注意的是ITolerances = TRUE意味着EqualTolerances = TRUE,但不反之亦然。在内部,二次项将被视为偏移(GLM术语),这样的模式可能会被安装非常有效的。然而,这是一个非常好的主意,中心和规模上的所有数值变量,x_2矢量。更多详细信息,请参阅详细信息。 ITolerances = TRUE的成功往往取决于isdlv和/或MUXfactor合适的值。


参数:maxitl
Maximum number of times the optimizer is called or restarted. Most users should ignore this argument.   
最大次数被称为优化或重新启动。大多数用户应该忽略此参数。


参数:imethod
Method of initialization. A positive integer 1 or 2 or 3 etc. depending on the VGAM family function. Currently it is used for negbinomial and  gamma2 only, and used within the C.   
的初始化方法。一个正整数1或2或3等,根据VGAM家庭功能。目前,它被用于negbinomial和gamma2唯一的,和使用内C.


参数:Maxit.optim
Positive integer. Number of iterations given to the function optim at each of the optim.maxit iterations.  
正整数。给函数的迭代数目optim在每个optim.maxit迭代。


参数:MUXfactor
Multiplication factor for detecting large offset values. Numeric, positive and of length R (recycled if necessary). This argument is used only if ITolerances = TRUE. Offsets are -0.5 multiplied by the sum of the squares of all R latent variable values. If the latent variable values are too large then this will result in numerical problems. By too large, it is meant that the standard deviation of the latent variable values are greater than MUXfactor[r] * isdlv[r] for r=1:Rank (this is why centering and scaling all the numerical predictor variables in x_2 is recommended). A value about 3 or 4 is recommended. If failure to converge occurs, try a slightly lower value.   
用于检测的大的偏移值的倍增因子。数字,积极长度R(回收如果必要的话)。这种说法是只有ITolerances = TRUE。偏移量是-0.5乘以所有R潜变量值的平方的总和。如果潜变量值过大,那么这将导致在数值的问题。过大,它的意思是潜变量的值的标准偏差大于MUXfactor[r] * isdlv[r]的r=1:Rank(这就是为什么所有的数值预测变量的中心和缩放x_2建议)。推荐值约3或4。如果出现收敛失败,请尝试使用较低的值。


参数:optim.maxit
Positive integer. Number of times optim is invoked. At iteration i, the ith value of Maxit.optim is fed into optim.  
正整数。次optim数被调用。在迭代i,i个Maxit.optim被送入optim的价值。


参数:Norrr
Formula giving terms that are not to be included in the reduced-rank regression (or formation of the latent variables), i.e., those belong to x_1. Those variables which do not make up the latent variable (reduced-rank regression) correspond to the B_1 matrix. The default is to omit the intercept term from the latent variables.   
公式提供的条款不被包括在降秩回归(或形成的潜变量),即那些属于x_1。这些变量不使潜变量对应的B_1矩阵(降秩回归)。默认情况下是忽略截距项的潜在变量。


参数:Parscale
Numerical and positive-valued vector of length C (recycled if necessary). Passed into optim(..., control=list(parscale=Parscale)); the elements of C become C / Parscale. Setting ITolerances = TRUE results in line searches that are very large, therefore C has to be scaled accordingly to avoid large step sizes.  See Details for more information. It's probably best to leave this argument alone.   
数值和积极的值向量的长度C(回收如果必要的话)。传递到optim(..., control=list(parscale=Parscale));的元素C成为C/Parscale。设置ITolerances = TRUE线搜索是非常大的,因此C必须相应地调整,以避免大的步长。请参阅更多信息的详细信息。这也可能是最好的独自离开这个说法。


参数:SD.Cinit
Standard deviation of the initial values for the elements of C. These are normally distributed with mean zero. This argument is used only if Use.Init.Poisson.QO = FALSE and C is not inputted using Cinit.  
的初始值的元素C的标准偏差。这些都是正态分布,均值为零。这种说法是只有Use.Init.Poisson.QO = FALSE和C不使用Cinit输入。


参数:trace
Logical indicating if output should be produced for each iteration. The default is TRUE because the calculations are numerically intensive, meaning it may take a long time, so that the user might think the computer has locked up if trace = FALSE.  
逻辑表明,如果输出应为每个迭代。默认值是TRUE因为计算是计算密集的,这意味着它可能需要很长的时间,因此,用户可能认为电脑已经锁定,如果trace = FALSE。


参数:SmallNo
Positive numeric between .Machine$double.eps and 0.0001.  Used to avoid under- or over-flow in the IRLS algorithm.  Used only if FastAlgorithm is TRUE.  
正数之间.Machine$double.eps和0.0001。用于避免在IRLS算法不足或过度流动。使用,只有FastAlgorithm是TRUE。


参数:Use.Init.Poisson.QO
Logical. If TRUE then the function .Init.Poisson.QO() is used to obtain initial values for the canonical coefficients C. If FALSE then random numbers are used instead.  
逻辑。如果TRUE然后.Init.Poisson.QO()功能的使用规范的系数C获得的初始值。如果FALSE然后随机数来代替。


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


参数:...
Ignored at present.  
目前被忽略。


Details

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

Recall that the central formula for CQO is
回想一下公式CQO中央是

where x_1 is a vector (usually just a 1 for an intercept), x_2 is a vector of environmental variables, nu=C^T x_2 is a R-vector of latent variables, e_m is a vector of 0s but with a 1 in the mth position. QRR-VGLMs are an extension of RR-VGLMs and allow for maximum likelihood solutions to constrained quadratic ordination (CQO) models.
x_1是一个向量(通常只有1对截距项),x_2是环境变量的向量,nu=C^T x_2是R的潜变量的向量, e_m是一个矢量的0,但用了1m个位置。 QRR VGLMs是的扩展RR-VGLMs,让约束二次统筹(CQO)模型的最大似然的解决方案。

Having ITolerances = TRUE means all the tolerance matrices are the order-R identity matrix, i.e., it forces bell-shaped curves/surfaces on all species. This results in a more difficult optimization problem (especially for 2-parameter models such as the negative binomial and gamma) because of overflow errors and it appears there are more local solutions. To help avoid the overflow errors, scaling C by the factor Parscale can help enormously. Even better, scaling C by specifying isdlv is more understandable to humans. If failure to converge occurs, try adjusting Parscale, or better, setting EqualTolerances = TRUE (and hope that the estimated tolerance matrix is positive-definite). To fit an equal-tolerances model, it is firstly best to try setting ITolerances = TRUE and varying isdlv and/or MUXfactor if it fails to converge. If it still fails to converge after many attempts, try setting EqualTolerances = TRUE, however this will usually be a lot slower because it requires a lot more memory.
有ITolerances = TRUE是指所有的耐受性矩阵的顺序R矩阵,即,它迫使钟形曲线/曲面上所有的物种。这导致在一个更加困难的优化问题(特别是2  - 参数模型,如具有负二项式和γ的),因为溢出错误,它似乎有多个本地的解决方案。为了帮助避免溢出错误,缩放C的因素Parscale可以帮助极大。更妙的是,缩放Cisdlv是更容易理解人类。如果出现收敛失败,请尝试调整Parscale,或更好,设置EqualTolerances = TRUE(希望估计误差矩阵是正定的)。为了适应等于公差模型,它首先是最好的尝试ITolerances = TRUE和不同isdlv和/或MUXfactor,如果它不能收敛。如果仍不能收敛经过多次尝试,尝试设置EqualTolerances = TRUE,然而,这通常是慢了很多,因为它需要更多的内存。

With a R > 1 model, the latent variables are always uncorrelated, i.e., the variance-covariance matrix of the site scores is a diagonal matrix.
随着R > 1模型,潜变量不相关的,即方差 - 协方差矩阵的网站分数是一个对角矩阵。

If setting EqualTolerances = TRUE is used and the common estimated tolerance matrix is positive-definite then that model is effectively the same as the ITolerances = TRUE model (the two are transformations of each other). In general, ITolerances = TRUE is numerically more unstable and presents a more difficult problem to optimize; the arguments isdlv and/or MUXfactor often must be assigned some good value(s) (possibly found by trial and error) in order for convergence to occur. Setting ITolerances = TRUE forces a bell-shaped curve or surface onto all the species data, therefore this option should be used with deliberation. If unsuitable, the resulting fit may be very misleading. Usually it is a good idea for the user to set EqualTolerances = FALSE to see which species appear to have a bell-shaped curve or surface. Improvements to the fit can often be achieved using transformations, e.g., nitrogen concentration to log nitrogen concentration.
如果设置EqualTolerances = TRUE使用和共同估计公差矩阵是正定的,那么该模型实际上是一样ITolerances = TRUE模型(这两者是相互转换)。在一般情况下,ITolerances = TRUE是数字更不稳定,提出了一个比较棘手的问题,以优化的参数isdlv和/或MUXfactor通常必须被分配(可能发现一些好的值(S)试验和错误)为了收敛到发生。设置ITolerances = TRUE强制钟形曲线或曲面上所有的物种数据,因此这个选项应该被用来进行审议。如果不适合,得到的配合可以是非常误导的。通常它为用户设置EqualTolerances = FALSE看的物种似乎有一个钟形曲线或曲面是一个好主意。适合的改进往往可以使用转换,例如,氮浓度,氮浓度记录。

Fitting a CAO model (see cao) first is a good idea for pre-examining the data and checking whether it is appropriate to fit a CQO model.
拟合曹模型(见cao)第一个预分析数据,检查它是否是适当的,以适应CQO模型是一个好主意。


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

A list with components matching the input names.
组件的列表匹配输入的名字。


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

The default value of Bestof is a bare minimum for many datasets, therefore it will be necessary to increase its value to increase the chances of obtaining the global solution.
Bestof的默认值是最低限度的许多数据集,因此有必要增加其价值,增加成功的机会获得全球性的解决方案。


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

When ITolerances = TRUE it is a good idea to apply scale to all the numerical variables that make up the latent variable, i.e., those of x_2. This is to make them have mean 0, and hence avoid large offset values which cause numerical problems.
当ITolerances = TRUE这是一个好主意,申请scale的所有变量的数值,使潜在的变量,即x_2。这是为了让他们有均值为0,因此避免出现大的偏移值,会引起数值问题。

This function has many arguments that are common with rrvglm.control and vglm.control.
此函数有很多参数是常见的rrvglm.control和vglm.control。

It is usually a good idea to try fitting a model with ITolerances = TRUE first, and if convergence is unsuccessful, then try EqualTolerances = TRUE and ITolerances = FALSE. Ordination diagrams with EqualTolerances = TRUE have a natural interpretation, but with EqualTolerances = FALSE they are more complicated and requires, e.g., contours to be overlaid on the ordination diagram (see lvplot.qrrvglm).
它通常是一个好主意,试图拟合模型ITolerances = TRUE第一,如果融合不成功,则尝试EqualTolerances = TRUE和ITolerances = FALSE。排序图EqualTolerances = TRUE有一个自然的解释,但用EqualTolerances = FALSE,“他们是更复杂的要求,例如,覆盖在统筹图的轮廓(见lvplot.qrrvglm”)。

In the example below, an equal-tolerances CQO model is fitted to the hunting spiders data. Because ITolerances = TRUE, it is a good idea to center all the x_2 variables first. Upon fitting the model, the actual standard deviation of the site scores are computed. Ideally, the isdlv argument should have had this value for the best chances of getting good initial values.  For comparison, the model is refitted with that value and it should run more faster and reliably.
在下面的例子中,等于公差的CQO模型是装的狩猎蜘蛛数据。因为ITolerances = TRUE,这是一个好主意,中心的所有x_2变量。一旦拟合模型,实际的标准偏差的站点分数计算。在理想的情况下,isdlv参数应该有最好的机会得到良好的初始值这个值。为了进行比较,该模型被改装的具有该值和它应该运行更快和更可靠。


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


Thomas W. Yee



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

A new technique for maximum-likelihood canonical Gaussian ordination. Ecological Monographs, 74, 685–701.
Constrained additive ordination. Ecology, 87, 203–213.

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

cqo, rcqo, Coef.qrrvglm, Coef.qrrvglm-class,    optim, binomialff, poissonff, negbinomial, gamma2, gaussianff.
cqo,rcqo,Coef.qrrvglm,Coef.qrrvglm-class,optim,binomialff,poissonff,negbinomial,gamma2,gaussianff。


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


# Poisson CQO with equal tolerances[泊松CQO等于公差]
set.seed(111)  # This leads to the global solution[这将导致全球性的解决方案]
hspider[,1:6] = scale(hspider[,1:6]) # Good idea when ITolerances = TRUE[好主意,当ITolerances = TRUE]
p1 = cqo(cbind(Alopacce, Alopcune, Alopfabr, Arctlute, Arctperi, Auloalbi,
               Pardlugu, Pardmont, Pardnigr, Pardpull, Trocterr, Zoraspin) ~
         WaterCon + BareSand + FallTwig + CoveMoss + CoveHerb + ReflLux,
         quasipoissonff, data = hspider, EqualTolerances = TRUE)
sort(p1@misc$deviance.Bestof) # A history of all the iterations[历史上所有的迭代]

(isdlv = apply(lv(p1), 2, sd)) # Should be approx isdlv[应约isdlv]

# Refit the model with better initial values[重新安装该模型具有更好的初始值]
set.seed(111)  # This leads to the global solution[这将导致全球性的解决方案]
p1 = cqo(cbind(Alopacce, Alopcune, Alopfabr, Arctlute, Arctperi, Auloalbi,
               Pardlugu, Pardmont, Pardnigr, Pardpull, Trocterr, Zoraspin) ~
         WaterCon + BareSand + FallTwig + CoveMoss + CoveHerb + ReflLux,
         ITolerances = TRUE, isdlv = isdlv,   # Note the use of isdlv here[注意使用isdlv在这里]
         fam = quasipoissonff, data = hspider)
sort(p1@misc$deviance.Bestof) # A history of all the iterations[历史上所有的迭代]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 16:58 , Processed in 0.023660 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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