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

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

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

                                         Fitting Reduced-Rank Vector Generalized Linear Models (RR-VGLMs)
                                         配件降秩向量广义线性模型(RR-VGLMs)

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

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

A reduced-rank vector generalized linear model (RR-VGLM) is fitted. RR-VGLMs are VGLMs but some of the constraint matrices are estimated. In this documentation, M is the number of linear predictors.
安装一个降维的向量广义线性模型(RR-VGLM)。 RR-VGLMs VGLMs但一些约束矩阵的估计。在本文档中,M是线性预测的数量。


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


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



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

参数:formula, family, weights
See vglm.  
见vglm。


参数: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 rrvglm is called.  
一个可选的数据框包含在模型中的变量。默认情况下,变量的environment(formula),通常是rrvglm被称为环境。


参数:subset, na.action
See vglm.  
见vglm。


参数:etastart, mustart, coefstart
See vglm.  
见vglm。


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


参数:offset, model, contrasts
See vglm.  
见vglm。


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


参数: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对象。


参数:constraints
See vglm.  
见vglm。


参数:extra, smart, qr.arg
See vglm.  
见vglm。


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


Details

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

The central formula is given by
由中央式由下式给出

where x1 is a vector (usually just a 1 for an intercept), x2 is another vector of explanatory variables, and nu = C^T x_2 is an R-vector of latent variables. Here, eta is a vector of linear predictors, e.g., the mth element is eta_m = log(E[Y_m]) for the mth Poisson response.  The matrices B_1, A and C are estimated from the data, i.e., contain the regression coefficients.  For ecologists, the central formula represents a constrained linear ordination (CLO) since it is linear in the latent variables. It means that the response is a monotonically increasing or decreasing function of the latent variables.
x1是一个向量(通常只有1对截距),x2是另一种的解释变量向量,并nu = C^T x_2R的潜变量的向量。在这里,eta是一个向量的线性预测,例如,m个元素是eta_m = log(E[Y_m])的m次泊松响应。矩阵B_1,A和C估计的数据,即包含的回归系数。生态学家,中央的公式表示的约束(CLO),因为它是线性的潜变量的线性协调。这意味着响应是一个单调递增或递减函数的潜变量。

For identifiability it is common to enforce corner constraints on A: by default, the top R by R submatrix is fixed to be the order-R identity matrix and the remainder of A is estimated.
可识别性是很常见的执行A:默认情况下,顶RR子矩阵是固定的顺序R单位矩阵,其余的角约束A估计。

The underlying algorithm of RR-VGLMs is iteratively reweighted least squares (IRLS) with an optimizing algorithm applied within each IRLS iteration (e.g., alternating algorithm).
底层算法RR-VGLMs的迭代加权最小二乘(IRLS)IRLS迭代在每个应用(例如,交替算法)的优化算法。

In theory, any VGAM family function that works for vglm and vgam should work for rrvglm too. The function that actually does the work is rrvglm.fit; it is vglm.fit with some extra code.
从理论上讲,任何VGAM家庭功能,工作vglm和vgam应为rrvglm太。的功能,实际上做的工作是rrvglm.fit是vglm.fit一些额外的代码。


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

An object of class "rrvglm", which has the the same slots as a "vglm" object. The only difference is that the some of the constraint matrices are estimates rather than known. But VGAM stores the models the same internally. The slots of "vglm" objects are described in vglm-class.
对象的类"rrvglm",作为一个"vglm"对象有相同的插槽。唯一的区别是,一些约束矩阵的估计,而不是已知的。但是VGAM存储模型相同的内部。 "vglm"对象的插槽中描述vglm-class。


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

The arguments of rrvglm are in general the same as those of vglm but with some extras in rrvglm.control.
rrvglm的参数是一样的vglm但有一些额外的rrvglm.control一般。

The smart prediction (smartpred) library is packed with the VGAM library.
智能预测(smartpred)VGAM库库是挤满了。

In an example below, a rank-1 stereotype model of Anderson (1984) is fitted to some car data. The reduced-rank regression is performed, adjusting for two covariates. Setting a trivial constraint matrix for the latent variable variables in x2 avoids a warning message when it is overwritten by a (common) estimated constraint matrix.  It shows that German cars tend to be more expensive than American cars, given a car of fixed weight and width.
在下面的例子中,一个等级1的刻板印象·安德森(1984)的模型装配到一些汽车数据。降秩回归,两个协变量进行调整。设置一个简单的约束矩阵的潜变量的变量x2避免了警告消息,当它被覆盖(共同的)估计的约束矩阵。这表明,德系车往往比美国车更贵,一车固定的重量和宽度。

If fit <- rrvglm(..., data = mydata) then summary(fit) requires corner constraints and no missing values in mydata.  Often the estimated variance-covariance matrix of the parameters is not positive-definite; if this occurs, try refitting the model with a different value for Index.corner.
如果fit <- rrvglm(..., data = mydata)然后summary(fit)需要在mydata角的限制和没有缺失值。通常情况下,估计方差 - 协方差矩阵的参数是不是正定的,如果发生这种情况,请尝试重新安装不同的值Index.corner模型。

For constrained quadratic ordination (CQO) see cqo for more details about QRR-VGLMs.
对于约束二次协调(CQO)cqo更详细的QRR-VGLMs。

With multivariate binary responses, one must use binomialff(mv = TRUE) to indicate that the response (matrix) is multivariate. Otherwise, it is interpreted as a single binary response variable.
随着多元二进制反应的,必须使用binomialff(mv = TRUE)表明响应(矩阵)是多元的。否则,它被解释为一个单一的二进制响应变量。


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


Thomas W. Yee



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

Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15&ndash;41.
A new technique for maximum-likelihood canonical Gaussian ordination. Ecological Monographs, 74, 685&ndash;701.
Regression and ordered categorical variables. Journal of the Royal Statistical Society, Series B, Methodological, 46, 1&ndash;30.
Two-parameter reduced-rank vector generalized linear models. In preparation.
http://www.stat.auckland.ac.nz/~yee contains further information and examples.

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

rrvglm.control,  lvplot.rrvglm (same as biplot.rrvglm),  rrvglm-class, grc, cqo, vglmff-class, vglm, vglm-class, smartpred, rrvglm.fit. Special family functions include negbinomial zipoisson and zinegbinomial. (see Yee (2012) and COZIGAM). Methods functions include Coef.rrvglm, summary.rrvglm, etc. Data include crashi.
rrvglm.control,lvplot.rrvglm(biplot.rrvglm相同),rrvglm-class,grc,cqo,vglmff-class,vglm ,vglm-class,smartpred,rrvglm.fit。特殊的家庭功能包括negbinomialzipoisson和zinegbinomial。 (见议(2012年)和COZIGAM)。方法的功能包括Coef.rrvglm,summary.rrvglm,等数据包括crashi。


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


# Example 1: RR negative binomial (RR-NB) with Var(Y) = mu + delta1 * mu^delta2[例1:RR(RR-NB负二项分布)VAR(Y)= MU + DELTA1 *亩^ DELTA2中]
nn &lt;- 1000       # Number of observations[若干意见]
delta1 &lt;- 3.0    # Specify this[指定此]
delta2 &lt;- 1.5    # Specify this; should be greater than unity[指定这应该是大于1]
a21 <- 2 - delta2
mydata <- data.frame(x2 = runif(nn), x3 = runif(nn))
mydata <- transform(mydata, mu = exp(2 + 3 * x2 + 0 * x3))
mydata <- transform(mydata, y2 = rnbinom(nn, mu=mu, size=(1/delta1)*mu^a21))
## Not run: [#不运行:]
plot(y2 ~ x2, data = mydata, pch = "+", col = 'blue', las = 1,
     main = paste("Var(Y) = mu + ", delta1, " * mu^", delta2, sep = ""))
## End(Not run)[#(不执行)]
rrnb2 <- rrvglm(y2 ~ x2 + x3, negbinomial(zero = NULL), mydata, trace = TRUE)

a21.hat <- (Coef(rrnb2)@A)["log(size)", 1]
beta11.hat <- Coef(rrnb2)@B1["(Intercept)", "log(mu)"]
beta21.hat <- Coef(rrnb2)@B1["(Intercept)", "log(size)"]
(delta1.hat <- exp(a21.hat * beta11.hat - beta21.hat))
(delta2.hat <- 2 - a21.hat)
# exp(a21.hat * predict(rrnb2)[1,1] - predict(rrnb2)[1,2]) # delta1.hat[EXP(a21.hat预测(rrnb2)的[1,1]  - 预测(rrnb2)[1,2])#delta1.hat]
summary(rrnb2)

# Obtain a 95 percent confidence interval for delta2:[获得了95%的置信区间DELTA2:]
se.a21.hat <- sqrt(vcov(rrnb2)["I(lv.mat)", "I(lv.mat)"])
ci.a21 <- a21.hat +  c(-1, 1) * 1.96 * se.a21.hat
(ci.delta2 &lt;- 2 - rev(ci.a21))  # The 95 percent confidence interval[95%的置信区间]

confint_rrnb(rrnb2)  # Quick way to get it[快速的方式得到它]

# Plot the abundances and fitted values against the latent variable[绘制的丰度和对潜变量的拟合值]
## Not run: [#不运行:]
plot(y2 ~ lv(rrnb2), data = mydata, col = "blue",
          xlab = "Latent variable", las = 1)
ooo <- order(lv(rrnb2))
lines(fitted(rrnb2)[ooo] ~ lv(rrnb2)[ooo], col = "red")
## End(Not run)[#(不执行)]

# Example 2: stereotype model (reduced-rank multinomial logit model)[例2:定型模型(降秩多项Logit模型)]
data(car.all)
index = with(car.all, Country == "Germany" | Country == "USA" |
                      Country == "Japan"   | Country == "Korea")
scar = car.all[index, ]  # standardized car data[标准化的汽车数据]
fcols = c(13,14,18:20,22:26,29:31,33,34,36)  # These are factors[这些因素]
scar[,-fcols] = scale(scar[, -fcols]) # Standardize all numerical vars[所有的数值瓦尔标准化]
ones = matrix(1, 3, 1)
clist = list("(Intercept)" = diag(3), Width = ones, Weight = ones,
             Disp. = diag(3), Tank = diag(3), Price = diag(3),
             Frt.Leg.Room = diag(3))
set.seed(111)
fit = rrvglm(Country ~ Width + Weight + Disp. + Tank + Price + Frt.Leg.Room,
             multinomial, data =  scar, Rank = 2, trace = TRUE,
             constraints = clist, Norrr = ~ 1 + Width + Weight,
             Uncor = TRUE, Corner = FALSE, Bestof = 2)
fit@misc$deviance  # A history of the fits[一个历史的拟合]
Coef(fit)
## Not run:  biplot(fit, chull = TRUE, scores = TRUE, clty = 2, Ccex = 2,[#不运行:双标图(适合chull = TRUE,分数= TRUE,clty = 2,Ccex = 2,]
       ccol = "blue", scol = "red", Ccol = "darkgreen", Clwd = 2,
       main = "1=Germany, 2=Japan, 3=Korea, 4=USA")
## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 12:52 , Processed in 0.025746 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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