grc(VGAM)
grc()所属R语言包:VGAM
Row-Column Association Models including Goodman's RC Association Model
,包括古德曼的RC协会型号的行列关联模型
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Fits a Goodman's RC association model to a matrix of counts, and more generally, a sub-class of row-column association models.
适合一个古德曼的RC关联模型矩阵的计数,和更普遍的是,行 - 列关联模型的一个子类。
用法----------Usage----------
grc(y, Rank = 1, Index.corner = 21 + Rank),
szero = 1, summary.arg = FALSE, h.step = 1e-04, ...)
rcam(y, family = poissonff, Rank = 0, Musual = NULL,
weights = NULL, which.lp = 1,
Index.corner = if (!Rank) NULL else 1 + Musual * (1:Rank),
rprefix = "Row.", cprefix = "Col.", offset = 0,
szero = if (!Rank) NULL else {
if (Musual == 1) 1 else setdiff(1Musual * ncol(y)),
c(1 + (1:ncol(y)) * Musual, Index.corner))
},
summary.arg = FALSE, h.step = 0.0001,
rbaseline = 1, cbaseline = 1, ...)
参数----------Arguments----------
参数:y
For grc a matrix of counts. For rcam a general matrix response depending on family. Output from table() is acceptable; it is converted into a matrix. Note that y should be at least 3 by 3 in dimension.
对于grc矩阵的计数。对于rcam一般矩阵响应,根据family。输出从table()是可接受的,它被转换成一个矩阵。请注意,y至少应为3×3的尺寸。
参数:family
A VGAM family function. By default, the first linear/additive predictor is fitted using main effects plus an optional rank-Rank interaction term. Not all family functions are suitable or make sense. All other linear/additive predictors are fitted using an intercept-only, so it has a common value over all rows and columns. For example, zipoissonff may be suitable for counts but not zipoisson because of the ordering of the linear/additive predictors. If the VGAM family function does not have an infos slot then Musual needs to be inputted (the number of linear predictors for an ordinary (usually univariate) response, aka M). The VGAM family function also needs to be able to handle multiple responses; and not all of them can do this.
AVGAM家庭功能。默认情况下,第一次安装使用的主效应加上一个可选的秩Rank交互项线性/添加剂预测。并非所有的家庭功能是合适的或有意义的。所有其他的线性/添加剂的预测仅截距安装使用,所以它有一个共同的价值超过所有的行和列。例如,zipoissonff可能是适合于计数,但不zipoisson因为线性/添加剂的预测因子的顺序。如果VGAM家庭功能不具备infos插槽然后Musual需要输入(一个普通的(通常是单变量)响应的线性预测,又名M )。 VGAM家庭功能也需要能够处理多个响应,而不是所有的人都可以做到这一点。
参数:Rank
An integer from the set {0,...,min(nrow(y), ncol(y))}. This is the dimension of the fit in terms of the interaction. For grc() this argument must be positive. A value of 0 means no interactions (i.e., main effects only); each row and column is represented by an indicator variable.
整数集合{0,...,min(nrow(y), ncol(y))}。这是一个方面的相互作用的配合尺寸。 grc()该参数必须是积极的。值为0表示无相互作用(即主要作用),每一行和每一列代表的指标变量。
参数:weights
Prior weights. Fed into rrvglm or vglm.
在此之前的权重。送入rrvglm或vglm。
参数:which.lp
Single integer. Specifies which linear predictor is modelled as the sum of an intercept, row effect, column effect plus an optional interaction term. It should be one value from the set 1:Musual.
一个整数。指定被建模为线性预测的拦截,排效果的总和,柱效,加上一个可选的交互项。它应是从该组1:Musual的一个值。
参数:Index.corner
A vector of Rank integers. These are used to store the Rank by Rank identity matrix in the A matrix; corner constraints are used.
的矢量Rank整数。这些是用来存储RankRank在A矩阵的单位矩阵;角落约束用于。
参数:rprefix, cprefix
Character, for rows and columns resp. For labelling the indicator variables.
字符,行和列的RESP账户。对于标签的指标变量。
参数:offset
Numeric. Either a matrix of the right dimension, else a single numeric expanded into such a matrix.
数字。无论是正确的维度的矩阵,否则这样一个矩阵扩展成一个单一的数字。
参数:szero
An integer from the set {1,...,min(nrow(y), ncol(y))}, specifying the row that is used as the structural zero.
从集合{1,...,min(nrow(y), ncol(y))},指定的行是用作结构零的整数。
参数:summary.arg
Logical. If TRUE, a summary is returned. If TRUE, y may be the output (fitted object) of grc().
逻辑。如果TRUE,返回的总结。如果TRUE,y可能是输出(合身的对象)的grc()。
参数:h.step
A small positive value that is passed into summary.rrvglm(). Only used when summary.arg = TRUE.
一个很小的正数被传递到summary.rrvglm()。仅用于summary.arg = TRUE。
参数:...
Arguments that are passed into rrvglm.control().
参数传递到rrvglm.control()。
参数:Musual
The number of linear predictors of the VGAM family function for an ordinary (univariate) response. Then the number of linear predictors of the rcam() fit is usually the number of columns of y multiplied by Musual. The default is to evaluate the infos slot of the VGAM family function to try to evaluate it; see vglmff-class. If this information is not yet supplied by the family function then the value needs to be inputted manually using this argument.
数的线性预测的VGAMfamily功能对于一个普通的单变量响应。然后,通常是线性预测的数目rcam()适合在y乘以Musual的列数目。默认值是评估infos的VGAMfamily函数插槽尝试评估; vglmff-class。如果此信息尚未提供家庭的功能,那么使用此参数的值需要手动输入。
参数:rbaseline, cbaseline
Baseline reference levels for the rows and columns. Currently stored on the object but not used.
基线参考水平的行和列。目前存储的对象,但没有使用。
Details
详细信息----------Details----------
Goodman's RC association model fits a reduced-rank approximation to a table of counts. The log of each cell mean is decomposed as an intercept plus a row effect plus a column effect plus a reduced-rank component. The latter can be collectively written A %*% t(C), the product of two "thin" matrices. Indeed, A and C have Rank columns. By default, the first column and row of the interaction matrix A %*% t(C) is chosen to be structural zeros, because szero = 1. This means the first row of A are all zeros.
古德曼的RC关联模型拟合降秩逼近表的计数。每个单元平均的log被分解为截距加一排的效果,加上一列效应加上降秩的组成部分。后者可共同书面A %*% t(C),产品的“薄”矩阵。事实上,A和C有Rank的列。默认情况下,第一列和行的互动矩阵A %*% t(C)选择是结构性的零,因为szero = 1。这意味着A都是零的第一行。
This function uses options()$contrasts to set up the row and column indicator variables. In particular, Equation (4.5) of Yee and Hastie (2003) is used. These are called Row. and Col. (by default) followed by the row or column number.
此功能使用options()$contrasts设立的行和列的指标变量。特别是,方程(4.5)的Yee和哈斯蒂(2003)的使用。这些被称为Row.和Col.(默认情况下)的行或列数。
The function rcam() is more general than grc(). Its default is a no-interaction model of grc(), i.e., rank-0 and a Poisson distribution. This means that each row and column has a dummy variable associated with it. The first row and column is baseline. The power of rcam() is that many VGAM family functions can be assigned to its family argument. For example, normal1 fits something in between a 2-way ANOVA with and without interactions, alaplace2 with Rank = 0 is something like medpolish. Others include zipoissonff, negbinomial. Hopefully one day all VGAM family functions will work when assigned to the family argument, although the result may not have meaning.
函数rcam()一般比grc()。它的默认值是没有grc(),即职级0与泊松分布交互模型。这意味着,每行和每列有与它相关联的一个虚拟变量。的第一行和列是基线。的力量rcam()的是,许多VGAM的家庭功能可以分配给它的family参数。例如,normal1适合的东西之间的2-way ANOVA分析,无互动的,alaplace2Rank = 0是的东西medpolish。其他包括zipoissonff,negbinomial。希望有一天所有的VGAM的家庭功能将分配给family参数时,虽然结果可能不具有任何意义。
值----------Value----------
An object of class "grc", which currently is the same as an "rrvglm" object. Currently, a rank-0 rcam() object is of class rcam0-class, else of class "rcam" (this may change in the future).
类的一个对象"grc",目前是一样的"rrvglm"对象。目前,排名0 rcam()对象是类的rcam0-class,其他类"rcam"(这可能在未来改变)。
警告----------Warning----------
The function rcam() is experimental at this stage and may have bugs. Quite a lot of expertise is needed when fitting and in its interpretion thereof. For example, the constraint matrices applies the reduced-rank regression to the first (see which.lp) linear predictor and the other linear predictors are intercept-only and have a common value throughout the entire data set. This means that, by default, family = zipoissonff is appropriate but not family = zipoisson. Else set family = zipoisson and which.lp = 2. To understand what is going on, do examine the constraint matrices of the fitted object, and reconcile this with Equations (4.3) to (4.5) of Yee and Hastie (2003).
函数rcam()在这个阶段,是实验性的,可能有错误。装修时,在其解译,需要相当多的专业知识。例如,约束矩阵降秩回归应用于第一(见which.lp)线性预测器和其他线性预测是仅截距,并有一个共同的值在整个数据集。这意味着,默认情况下,“family =zipoissonff是适当的,但不family =zipoisson的。否则设置family =zipoisson和which.lp = 2。要明白是怎么回事,做检查约束矩阵的拟合对象,这与方程(4.3)(4.5)(2003)仪和哈斯蒂调和。
The functions temporarily create a permanent data frame called .grc.df or .rcam.df, which used to be needed by summary.rrvglm(). Then these data frames are deleted before exiting the function. If an error occurs, then the data frames may be present in the workspace.
该功能暂时建立一个永久的数据框称为.grc.df或.rcam.df,所需要的summary.rrvglm()。然后,这些数据框都将被删除,然后退出函数。如果发生错误,那么在工作区中的数据框可以是本。
注意----------Note----------
These functions set up the indicator variables etc. before calling rrvglm or vglm. The ... is passed into rrvglm.control or vglm.control, This means, e.g., Rank = 1 is default for grc().
这些功能的指标变量等前调用rrvglm或vglm。被传递到...或rrvglm.control,这意味着,例如,vglm.control是默认为Rank = 1grc()。
The data should be labelled with rownames and colnames. Setting trace = TRUE is recommended for monitoring convergence. Using criterion = "coefficients" can result in slow convergence.
这些数据应标有rownames和colnames。设置trace = TRUE建议用于监视收敛。使用criterion = "coefficients"可能会导致收敛速度慢。
If summary = TRUE, then y can be a "grc" object, in which case a summary can be returned. That is, grc(y, summary = TRUE) is equivalent to summary(grc(y)).
如果summary = TRUE,那么y是"grc"对象,在这种情况下,可以返回一个总结。也就是说,grc(y, summary = TRUE)是相当于summary(grc(y))的。
(作者)----------Author(s)----------
Thomas W. Yee, with
assistance from Alfian F. Hadi.
参考文献----------References----------
Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.
Row-column association models In preparation.
Association models and canonical correlation in the analysis of cross-classifications having ordered categories. Journal of the American Statistical Association, 76, 320–334.
http://www.stat.auckland.ac.nz/~yee contains further information about the setting up of the indicator variables.
参见----------See Also----------
rrvglm, rrvglm.control, rrvglm-class, summary.grc, moffset, Rcam, Qvar, plotrcam0, alcoff, crashi, auuc, olympic, poissonff.
rrvglm,rrvglm.control,rrvglm-class,summary.grc,moffset,Rcam,Qvar,plotrcam0,alcoff,crashi,auuc,olympic,poissonff。
实例----------Examples----------
grc1 <- grc(auuc) # Undergraduate enrolments at Auckland University in 1990[于1990年在奥克兰大学本科入学]
fitted(grc1)
summary(grc1)
grc2 <- grc(auuc, Rank = 2, Index.corner = c(2, 5))
fitted(grc2)
summary(grc2)
# 2008 Summer Olympic Games in Beijing[2008年夏季奥运会在北京]
top10 <- head(olympic, n = 10)
oly1 <- with(top10, grc(cbind(gold, silver, bronze)))
round(fitted(oly1))
round(resid(oly1, type = "response"), dig = 1) # Response residuals[响应残差]
summary(oly1)
Coef(oly1)
# Roughly median polish[大致平均抛光]
rcam0 <- rcam(auuc, fam = alaplace2(tau = 0.5, intparloc = TRUE), trace = TRUE)
round(fitted(rcam0), dig = 0)
round(100 * (fitted(rcam0) - auuc) / auuc, dig = 0) # Discrepancy[差异]
rcam0@y
round(coef(rcam0, matrix = TRUE), dig = 2)
print(Coef(rcam0, matrix = TRUE), dig = 3)
# constraints(rcam0)[的限制(rcam0)]
names(constraints(rcam0))
# Compare with medpolish():[比较用medpolish():]
(med.a <- medpolish(auuc))
fv <- med.a$overall + outer(med.a$row, med.a$col, "+")
round(100 * (fitted(rcam0) - fv) / fv) # Hopefully should be all 0s[我们希望为全0]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|