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

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

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

                                        Fitting Vector Generalized Linear Models
                                         配件向量广义线性模型

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

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

vglm is used to fit vector generalized linear models (VGLMs). This is a very large class of models that includes generalized linear models (GLMs) as a special case.
vglm使用,以适应向量广义线性模型(VGLMs)。这是一个非常大的类模型,包括广义线性模型(GLMS)作为一个特殊的情况下。


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


vglm(formula, family, data = list(), weights = NULL, subset = NULL,
     na.action = na.fail, etastart = NULL, mustart = NULL,
     coefstart = NULL, control = vglm.control(...), offset = NULL,
     method = "vglm.fit", model = FALSE, x.arg = TRUE, y.arg = TRUE,
     contrasts = NULL, constraints = NULL, extra = list(),
     form2 = NULL, qr.arg = TRUE, smart = TRUE, ...)



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

参数:formula
a symbolic description of the model to be fit. The RHS of the formula is applied to each linear predictor. Different variables in each linear predictor can be chosen by specifying constraint matrices.  
一个象征性的模型来描述是合适的。式的RHS被施加到每个线性预测。在每一个线性预测的不同变量,可以选择指定约束矩阵。


参数:family
a function of class "vglmff" (see vglmff-class) describing what statistical model is to be fitted. This is called a “VGAM family function”.  See CommonVGAMffArguments for general information about many types of arguments found in this type of function.  
一个类的函数"vglmff"(vglmff-class)描述统计模型是被安装。这就是所谓的“VGAM家庭功能”。见CommonVGAMffArguments的一般信息,发现这种类型的函数的参数的多种类型的。


参数:data
an optional data frame containing the variables in the model. By default the variables are taken from environment(formula), typically the environment from which vglm is called.  
一个可选的数据框包含在模型中的变量。默认情况下,变量的environment(formula),通常是vglm被称为环境。


参数:weights
an optional vector or matrix of (prior) weights to be used in the fitting process. If weights is a matrix, then it must be in matrix-band form, whereby the first M columns of the matrix are the diagonals, followed by the upper-diagonal band, followed by the band above that, etc. In this case, there can be up to M(M+1) columns, with the last column corresponding to the (1,M) elements of the weight matrices.  
在嵌合过程中要使用的可选的(现有)的权重向量或矩阵。如果weights是一个矩阵,那么它必须是在矩阵带的形式,由此,第一M列的矩阵的对角线,随后由上部对角线频带,随后由上述频带中该在这种情况下,有可高达M(M+1)列,与最后一列相对应的(1,M)的权重矩阵的元素。


参数:subset
an optional logical vector specifying a subset of observations to  be used in the fitting process.  
一个可选的逻辑矢量指定的装配过程中可以使用的观测值的一个子集。


参数:na.action
a function which indicates what should happen when the data contain NAs.  The default is set by the na.action setting of options, and is na.fail if that is unset. The “factory-fresh” default is na.omit.  
一个函数,它表示当数据包含NA的,应该发生什么。默认设置是由na.action的options,是na.fail,如果是没有设置的。 “出厂时的默认是na.omit。


参数:etastart
starting values for the linear predictors. It is a M-column matrix with the same number of rows as the response. If M = 1 then it may be a vector. Note that etastart and the output of predict(fit) should be comparable. Here, fit is the fitted object.  
开始的线性预测值。它是M作为响应具有相同数目的行的列的矩阵。如果M = 1然后它可能是一个矢量。请注意etastart和predict(fit)输出应相媲美。在这里,fit是的合身的对象。


参数:mustart
starting values for the fitted values. It can be a vector or a matrix; if a matrix, then it has the same number of rows as the response. Usually mustart and the output of fitted(fit) should be comparable. Some family functions do not make use of this argument.  
拟合值的初始值。它可以是一个矢量或矩阵,如果一个矩阵,然后,作为响应,它具有相同的行数。通常是mustart和fitted(fit)输出应该是可比的。有些家庭功能不使用这种说法。


参数:coefstart
starting values for the coefficient vector. The length and order must match that of coef(fit).  
的系数向量的初始值。的长度和顺序必须符合的coef(fit)。


参数:control
a list of parameters for controlling the fitting process.  See vglm.control for details.  
的参数,用于控制的嵌合过程的列表。见vglm.control的详细信息。


参数:offset
a vector or M-column matrix of offset values. These are a priori known and are added to the linear predictors during fitting.  
一个向量或M的列矩阵的偏移值。这些是先验已知的,并且在配合期间添加到的线性预测。


参数:method
the method to be used in fitting the model.  The default (and presently only) method vglm.fit() uses iteratively reweighted least squares (IRLS).  
该方法被用于拟合模型。默认情况下,(目前)的方法vglm.fit()使用迭代加权最小二乘(IRLS)。


参数:model
a logical value indicating whether the model frame should be assigned in the model slot.  
一个逻辑值,该值指示是否应该被分配在model插槽的模型框架。


参数:x.arg, y.arg
logical values indicating whether the model matrix and response vector/matrix used in the fitting process should be assigned in the x and y slots. Note the model matrix is the LM model matrix; to get the VGLM model matrix type model.matrix(vglmfit) where vglmfit is a vglm object.   
逻辑值指示是否模型矩阵和的响应向量/矩阵在装修过程中使用应分配在x和y槽。请注意是LM模型矩阵模型矩阵;,到得到的VGLM的模型的矩阵式model.matrix(vglmfit)其中vglmfit是一个的vglm对象。


参数:contrasts
an optional list. See the contrasts.arg of model.matrix.default.  
可选列表。请参阅contrasts.argmodel.matrix.default。


参数:constraints
an optional list  of constraint matrices. The components of the list must be named with the term it corresponds to (and it must match in character format exactly). There are two types of input: "lm"-type and "vlm"-type. The former is a subset of the latter. The former has a matrix for each term of the LM matrix. The latter has a matrix for each column of the VLM matrix. After fitting, the constraints extractor function may be applied; it returns the "vlm"-type list of constraint matrices by default.  If "lm"-type are returned by constraints then these can be fed into this argument and it should give the same model as before.  Each constraint matrix must have M rows, and be of full-column rank.  By default, constraint matrices are the M by M identity matrix unless arguments in the family function itself override these values, e.g., parallel (see  CommonVGAMffArguments). If constraints is used it must contain all the terms; an incomplete list is not accepted.  
约束矩阵的可选列表。的列表中的组件必须被命名为与它对应的术语(及它必须匹配以字符格式完全相同)。有两种类型的输入:"lm"型和"vlm"型。前者是后者的一个子集。前者有每学期的LM矩阵的矩阵。后者有一个矩阵的每一列的VLM矩阵。拟合后,constraints提取功能可以被应用,它返回"vlm"型约束矩阵列表默认情况下。如果"lm"型返回constraints,那么这些都可以被送入这种说法,它应该给予相同的模型前。每个约束矩阵必须有M行,全列秩。默认情况下,约束矩阵M的M的的身份矩阵,除非在家庭中的参数函数本身覆盖这些值,例如,parallel(见CommonVGAMffArguments)。如果constraints使用它必须包含的所有条款,不接受不完整的名单。


参数:extra
an optional list with any extra information that might be needed by the VGAM family function.  
任何额外的信息可能需要VGAM家庭功能的可选列表。


参数:form2
The second (optional) formula. If argument xij is used (see vglm.control) then form2 needs to have all terms in the model. Also, some VGAM family functions such as micmen use this argument to input the regressor variable. If given, the slots @Xm2 and @Ym2 may be assigned. Note that smart prediction applies to terms in form2 too.  
第二个(可选)公式。如果参数xij(vglm.control),然后form2需要有模型中的所有条款。此外,一些VGAM的家庭功能如micmen使用此参数的回归量输入变量。如果给定插槽@Xm2和@Ym2可能会被分配。需要注意的是智能预测适用于form2太。


参数:qr.arg
logical value indicating whether the slot qr, which returns the QR decomposition of the VLM model matrix, is returned on the object.  
逻辑值,该值指示该时隙是否qr,它返回的的VLM模型矩阵的QR分解,则返回的对象。


参数:smart
logical value indicating whether smart prediction (smartpred) will be used.  
逻辑值,该值指示是否智能预测(smartpred)的使用。


参数:...
further arguments passed into vglm.control.  
进一步的参数传递到vglm.control。


Details

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

A vector generalized linear model (VGLM) is loosely defined as a statistical model that is a function of M linear predictors. The central formula is given by
一个向量广义线性模型(VGLM)被宽泛地定义为是一个功能的M线性预测的统计模型。由中央式由下式给出

where x is a vector of explanatory variables (sometimes just a 1 for an intercept), and beta_j is a vector of regression coefficients to be estimated. Here, j=1,…,M, where M is finite. Then one can write eta=(eta_1,…,η_M)^T as a vector of linear predictors.
x的解释变量(有时仅仅是1的拦截)是一个向量,和beta_j是一个向量回归系数估计。在这里,j=1,…,M,其中M是有限的。那么可以写成eta=(eta_1,…,η_M)^T作为一个向量的线性预测的。

Most users will find vglm similar in flavour to glm. The function vglm.fit actually does the work.
大多数用户会发现vglm相似的味道glm。函数vglm.fit实际上做的工作。


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

An object of class "vglm", which has the following slots. Some of these may not be assigned to save space, and will be recreated if necessary later.
一个对象的类"vglm"的,它具有以下插槽。其中有些可能不被分配,以节省空间,并将于稍后如有必要,重新。


参数:extra
the list extra at the end of fitting.
列表extra在年底嵌合。


参数:family
the family function (of class "vglmff").
家庭的功能(类"vglmff"“)。


参数:iter
the number of IRLS iterations used.
IRLS迭代的数量使用。


参数:predictors
a M-column matrix of linear predictors.
一个M的列矩阵的线性预测。


参数:assign
a named list which matches the columns and the (LM) model matrix terms.
命名列表相匹配的列(LM)模型矩阵条款。


参数:call
the matched call.
匹配的呼叫。


参数:coefficients
a named vector of coefficients.
一个命名的系数向量。


参数:constraints
a named list of constraint matrices used in the fitting.  
装修中使用的命名列表的约束矩阵。


参数:contrasts
the contrasts used (if any).
使用的对比(如有的话)。


参数:control
list of control parameter used in the fitting.
装修中使用的控制参数列表。


参数:criterion
list of convergence criterion evaluated at the final IRLS iteration.
列表在最后IRLS迭代收敛标准评估。


参数:df.residual
the residual degrees of freedom.
的剩余自由度。


参数:df.total
the total degrees of freedom.
总自由度。


参数:dispersion
the scaling parameter.
缩放参数。


参数:effects
the effects.
的效果。


参数:fitted.values
the fitted values, as a matrix. This is often the mean but may be quantiles, or the location parameter, e.g., in the Cauchy model.  
的拟合值,作为一个矩阵。这是经常的意思,但可能会位数,或位置参数,例如,在柯西模型。


参数:misc
a list to hold miscellaneous parameters.
一个列表以持有杂项参数。


参数:model
the model frame.
模型框架。


参数:na.action
a list holding information about missing values.
一个遗漏值的列表保存的信息。


参数:offset
if non-zero, a M-column matrix of offsets.
如果不为零,M列的矩阵的偏移量。


参数:post
a list where post-analysis results may be put.
分析后的结果可能会提出一个列表,其中。


参数:preplot
used by plotvgam, the plotting parameters may be put here.
使用plotvgam,绘图参数可以放在这里。


参数:prior.weights
initially supplied weights (the weights argument). Also see weightsvglm.  
最初提供的的重量(weights参数)。另请参阅weightsvglm。


参数:qr
the QR decomposition used in the fitting.
装修中使用的QR分解。


参数:R
the R matrix in the QR decomposition used in the fitting.
在接头中使用的QR分解的R矩阵。


参数:rank
numerical rank of the fitted model.
数值秩的拟合模型。


参数:residuals
the working residuals at the final IRLS iteration.
最终IRLS迭代工作残差。


参数:rss
residual sum of squares at the final IRLS iteration with the adjusted dependent vectors and weight matrices.
在与调整后的依赖向量和权重矩阵的最后IRLS迭代平方剩余总和。


参数:smart.prediction
a list of data-dependent parameters (if any) that are used by smart prediction.  
列表中的数据相关的参数(如果有的话)所使用的智能预测。


参数:terms
the terms object used.
terms对象。


参数:weights
the working weight matrices at the final IRLS iteration. This is in matrix-band form.
工作重量矩阵在最后IRLS迭代。这是在矩阵带的形式。


参数:x
the model matrix (linear model LM, not VGLM).
模型矩阵(线性模型LM,不VGLM)。


参数:xlevels
the levels of the factors, if any, used in fitting.
的水平的因素,如果没有,使用接头。


参数:y
the response, in matrix form.
的响应,以矩阵形式。

This slot information is repeated at vglm-class.
这个插槽信息重复vglm-class。


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

This function can fit a wide variety of statistical models. Some of these are harder to fit than others because of inherent numerical difficulties associated with some of them. Successful model fitting benefits from cumulative experience. Varying the values of arguments in the VGAM family function itself is a good first step if difficulties arise, especially if initial values can be inputted. A second, more general step, is to vary the values of arguments in vglm.control. A third step is to make use of arguments such as etastart, coefstart and mustart.
此功能可以适合各种各样的统计模型。其中有些是比别人更难适应,因为与其中一些固有的数值困难。成功的模型拟合累积的经验。不同的参数值在VGAM家庭功能本身是一个很好的第一步,如果出现困难,特别是如果输入初始值可以使用。第二,更多的一般步骤,是在vglm.control改变参数的值。第三步是使用的参数,如etastart,coefstart和mustart。

Some VGAM family functions end in "ff" to avoid interference with other functions, e.g., binomialff, poissonff, gaussianff, gammaff. This is because VGAM family functions are incompatible with glm (and also gam in the gam library and gam in the mgcv library).
一些VGAM家庭功能以"ff",以避免干扰其他功能,例如,binomialff,poissonff,gaussianff,gammaff。这是因为VGAM的家庭功能不兼容glm(和gamgam库和gammgcv库)。

The smart prediction (smartpred) library is incorporated within the VGAM library.
智能预测(smartpredVGAM库)图书馆内注册成立。

The theory behind the scaling parameter is currently being made more rigorous, but it it should give the same value as the scale parameter for GLMs.
缩放参数背后的理论,目前正在作出更严格的,但它应该得到相同的值作为尺度参数GLMS。

In Example 5 below, the xij argument to illustrate covariates that are specific to a linear predictor. Here, lop/rop are the ocular pressures of the left/right eye (artificial data). Variables leye and reye might be the presence/absence of a particular disease on the LHS/RHS eye respectively. See vglm.control and fill for more details and examples.
在下面的例5,xij参数来说明特定的线性预测的协变量。在这里,lop/rop(人工数据)的左/右眼的眼压力。变量leye和reye可能会对一个特定的疾病上的左/右轴眼分别的存在/不存在。见vglm.control和fill更多细节和例子。


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


Thomas W. Yee



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

Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.
Vector generalized additive models. Journal of the Royal Statistical Society, Series B, Methodological, 58, 481–493.
The <code>VGAM</code> Package. R News, 8, 28&ndash;39.
http://www.stat.auckland.ac.nz/~yee contains further information and examples.

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

vglm.control, vglm-class, vglmff-class, smartpred, vglm.fit, fill, rrvglm, vgam. Methods functions include  coef.vlm, hatvaluesvlm, predictvglm, summary.vglm, AIC.vglm, lrtest_vglm, etc.
vglm.control,vglm-class,vglmff-class,smartpred,vglm.fit,fill,rrvglm,vgam。方法的功能包括coef.vlm,hatvaluesvlm,predictvglm,summary.vglm,AIC.vglm,lrtest_vglm,等等。


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


# Example 1. See help(glm)[实施例1。见帮助(GLM)]
print(d.AD <- data.frame(treatment = gl(3, 3),
                         outcome = gl(3, 1, 9),
                         counts = c(18,17,15,20,10,20,25,13,12)))
vglm.D93 = vglm(counts ~ outcome + treatment, family = poissonff,
                data = d.AD, trace = TRUE)
summary(vglm.D93)


# Example 2. Multinomial logit model[实施例2。多项Logit模型]
pneumo = transform(pneumo, let = log(exposure.time))
vglm(cbind(normal, mild, severe) ~ let, multinomial, pneumo)


# Example 3. Proportional odds model[实施例3。比例优势模型]
fit3 = vglm(cbind(normal,mild,severe) ~ let, propodds, pneumo, trace = TRUE)
coef(fit3, matrix = TRUE)
constraints(fit3)
model.matrix(fit3, type = "lm") # LM model matrix[LM模型矩阵]
model.matrix(fit3)              # Larger VGLM (or VLM) model matrix[的较大VGLM(或VLM)模型矩阵]


# Example 4. Bivariate logistic model [实施例4。双变量Logistic回归模型]
fit4 = vglm(cbind(nBnW, nBW, BnW, BW) ~ age, binom2.or, coalminers)
coef(fit4, matrix = TRUE)
depvar(fit4)  # Response are proportions[响应比例]
weights(fit4, type = "prior")


# Example 5. The use of the xij argument (simple case).[实施例5。的xij表示参数的使用(简单的情况下)。]
# The constraint matrix for 'op' has one column.[运的约束矩阵有一列。]
nn = 1000
eyesdat = round(data.frame(lop = runif(nn),
                           rop = runif(nn),
                            op = runif(nn)), dig = 2)
eyesdat = transform(eyesdat, eta1 = -1+2*lop,
                             eta2 = -1+2*lop)
eyesdat = transform(eyesdat,
                    leye = rbinom(nn, size = 1, prob = logit(eta1, inv = TRUE)),
                    reye = rbinom(nn, size = 1, prob = logit(eta2, inv = TRUE)))
head(eyesdat)
fit5 = vglm(cbind(leye,reye) ~ op,
            binom2.or(exchangeable = TRUE, zero = 3),
            data = eyesdat, trace = TRUE,
            xij = list(op ~ lop + rop + fill(lop)),
            form2 = ~  op + lop + rop + fill(lop))
coef(fit5)
coef(fit5, matrix = TRUE)
constraints(fit5)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 13:40 , Processed in 0.028838 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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