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

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

[复制链接]
发表于 2012-10-1 14:45:39 | 显示全部楼层 |阅读模式
assoc(vcd)
assoc()所属R语言包:vcd

                                        Extended Association Plots
                                         扩展协会图

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

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

Produce an association plot indicating deviations from a specified independence model in a possibly high-dimensional contingency table.
产品说明偏离指定的独立模型在可能的高维列联表的关联图。


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


## Default S3 method:[默认方法]
assoc(x, row_vars = NULL, col_vars = NULL, compress = TRUE,
  xlim = NULL, ylim = NULL,
  spacing = spacing_conditional(sp = 0), spacing_args = list(),
  split_vertical = NULL, keep_aspect_ratio = FALSE,
  xscale = 0.9, yspace = unit(0.5, "lines"), main = NULL, sub = NULL,
  ..., residuals_type = "earson", gp_axis = gpar(lty = 3))
## S3 method for class 'formula'[类formula的方法]
assoc(formula, data = NULL, ..., subset = NULL, na.action = NULL, main = NULL, sub = NULL)



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

参数:x
a contingency table in array form with optional category labels specified in the dimnames(x) attribute, or an object inheriting from the "ftable" class (such as "structable" objects).
可选类别标签中指定的dimnames(x)属性,或对象继承"ftable"类(如"structable"对象)数组形式的应急表中。


参数:row_vars
a vector of integers giving the indices, or a character vector giving the names of the variables to be used for the rows of the association plot.
给出的指数,或给要用于关联图的行的变量的名称的字符矢量的矢量的整数。


参数:col_vars
a vector of integers giving the indices, or a character vector giving the names of the variables to be used for the columns of the association plot.
给出的指数,或给要用于关联图的列的变量的名称的字符矢量的矢量的整数。


参数:compress
logical; if FALSE, the space between the rows (columns) are chosen such that the total heights (widths) of the rows (columns) are all equal.  If TRUE, the space between rows and columns is fixed and hence the plot is more “compressed”.
逻辑;如果FALSE,之间的空间中的行(列)被选择,使得总的高度(宽度)的行(列)都是相等的。如果TRUE,行和列之间的空间是固定的,因此,图是“压缩”。


参数:xlim
a 2 x k matrix of doubles, k number of total columns of the plot.  The columns of xlim correspond to the columns of the association plot, the rows describe the column ranges (minimums in the first row, maximums in the second row).  If xlim is NULL, the ranges are determined from the residuals according to compress (if TRUE: widest range from each column, if FALSE: from the whole association plot matrix).
2 x k的矩阵一倍,k总列数的图。 xlim相对应的关联图的列的列中,行描述的列范围(最小值在第一行中,在第二行中的最大值)。如果xlim是NULL(compress,范围确定的残差根据如果TRUE:范围最广的每一列,如果FALSE:从整个协会图的矩阵)。


参数:ylim
a 2 x k matrix of doubles, k number of total rows of the plot.  The columns of ylim correspond to the rows of the association plot, the rows describe the column ranges (minimums in the first row, maximums in the second row).  If ylim is NULL, the ranges are determined from the residuals according to compress (if TRUE: widest range from each row, if FALSE: from the whole association plot matrix).
2 x k的矩阵一倍,k总行的图。 ylim对应关联图的行,行的列描述的列范围(最小值在第一行中,在第二行中的最大值)。如果ylim是NULL,范围确定的残差根据compress(如果TRUE:范围最广的每一行,如果FALSE:从整个协会图的矩阵)。


参数:spacing
a spacing object, a spacing function, or a corresponding generating function (see strucplot for more information).  The default is the spacing-generating function spacing_conditional that is (by default) called with the argument list spacing_args (see spacings for more details).
的间隔对象,的间隔功能,或对应的生成函数(见strucplot的详细信息)。默认值是间隔产生功能spacing_conditional(默认情况下)调用的参数列表spacing_args(见spacings更多细节)。


参数:spacing_args
list of arguments for the spacing-generating function, if specified (see strucplot for more information).
指定的间距生成函数的参数列表,如果(见strucplot的详细信息)。


参数:split_vertical
vector of logicals of length k, where k is the number of margins of x (default: FALSE). Values are recycled as needed. A TRUE component indicates that the corresponding dimension is folded into the columns, FALSE folds the dimension into the rows.
向量,逻辑值的长度k,其中k的利润是多少x(默认:FALSE)。价值被回收作为需要。 ATRUE组件表示,相应的尺寸倍数成列的,FALSE折入行的尺寸。


参数:keep_aspect_ratio
logical indicating whether the aspect ratio should be fixed or not.
逻辑表示的纵横比是否应该是固定的或不。


参数:residuals_type
a character string indicating the type of residuals to be computed. Currently, only Pearson residuals are supported.
一个字符串,表示要计算的残差的类型。目前,只有Pearson残差的支持。


参数:xscale
scale factor resizing the tile's width, thus adding additional space between the tiles.  
瓷砖之间的比例因子调整瓷砖的宽度,从而增加了额外的空间。


参数:yspace
object of class "unit" specifying additional space separating the rows.
对象的类"unit"指定额外的空格分隔的行。


参数:gp_axis
object of class "gpar" specifying the visual aspects of the tiles' baseline.
类的对象"gpar"指定的视觉方面的瓷砖的基线。


参数:formula
a formula object with possibly both left and right hand sides specifying the column and row variables of the flat table.
可能左和右手侧的平坦表指定的列和行的变量的公式对象。


参数:data
a data frame, list or environment containing the variables to be cross-tabulated, or an object inheriting from class table.
一个数据框,列表或环境中的变量进行交叉制表,或对象继承从类table。


参数:subset
an optional vector specifying a subset of observations to be used. Ignored if data is a contingency table.
一个可选的向量指定要使用的观测值的一个子集。如果忽略data是一个列联表。


参数:na.action
an optional function which indicates what should happen when the data contain NAs. Ignored if data is a contingency table.
一个可选的功能,显示时会发生什么的数据包含NA的。如果忽略data是一个列联表。


参数:main, sub
either a logical, or a character string used for plotting the main (sub) title.  If logical and TRUE, the name of the data object is used.
无论是一个逻辑,或字符串,用于绘制主(分)标题。如果逻辑和TRUE,的名称data对象使用。


参数:...
other parameters passed to strucplot
其他参数传递给strucplot


Details

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

Association plots have been suggested by Cohen (1980) and extended by Friendly (1992) and provide a means for visualizing the residuals of an independence model for a contingency table.
协会图已建议由Cohen(1980)和延长活动(1992年),并提供可视化的独立模型的残差列联表的一种手段。

assoc is a generic function and currently has a default method and a formula interface.  Both are high-level interfaces to the strucplot function, and produce (extended) association plots.  Most of the functionality is described there, such as specification of the independence model, labeling, legend, spacing, shading, and other graphical parameters.
assoc是一个通用的功能,目前有一个默认的方法和公式接口。这两个,strucplot功能是高层次的接口,并产生(扩展)关联图。大部分的功能描述,如规范的独立模式,标签,传说,间距,阴影,和其他图形参数。

For a contingency table, the signed contribution to Pearson's chi^2 for cell \{ij… k\} is
对于一个列联表,已签署的贡献Pearson的chi^2电池\{ij… k\}

where f_{ij…k} and e_{ij…k}  are the observed and  expected counts corresponding to the cell.  In the association plot, each cell is represented by a rectangle that has (signed) height proportional to d_{ij…k}  and width proportional to sqrt(e_{ij...k}), so that the area of the box is proportional to the difference in observed and expected frequencies.  The rectangles in each row are positioned relative to a baseline indicating independence (d_{ij…k} = 0).  If the observed frequency of a cell is greater than the expected one, the box rises above the baseline, and falls below otherwise.
f_{ij…k}和e_{ij…k}是观察和计数的单元相对应。在关联图中,每个小区具有(签名)高度正比d_{ij…k}和宽度正比于sqrt(e_{ij...k}),所以该区域的方块是正比于观察到的差异,和由一个矩形表示期望的频率。在每行中的矩形的位置相对于基线表示独立性(d_{ij…k} = 0)。如果所观察到的频率的单元是大于预期,方块上升基线以上,低于否则。

Additionally, the residuals can be colored depending on a specified shading scheme (see Meyer et al., 2003).  Package vcd offers a range of residual-based shadings (see the shadings help page). Some of them allow, e.g., the visualization of test statistics.
此外,残差可以取决于计划(见Meyer等人,2003年)上的指定的遮光着色。套件vcd提供了一系列的剩余阴影(见“阴影”的帮助页面)。其中一些允许,例如,可视化的检验统计量。

Unlike the assocplot function in the graphics package, this function allows the visualization of contingency tables with more than two dimensions. Similar to the construction of "flat" tables (like objects of class "ftable" or "structable"), the dimensions are folded into rows and columns.
不同的是assocplot graphics包的功能,此功能允许有两个以上尺寸的可视化应急表。建设“平”表(如类的对象相似"ftable"或"structable"),被倍数成的行和列的尺寸。

The layout is very flexible: the specification of shading, labeling, spacing, and legend is modularized (see strucplot for details).
布局是非常灵活的阴影,标签,间距,和传说中的规格是模块化的(见strucplot)。


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

The "structable" visualized is returned invisibly.
"structable"返回的可视化是不可见的。


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



David Meyer <a href="mailtoavid.Meyer@R-project.org">David.Meyer@R-project.org</a>




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

On the graphical display of the significant components in a two-way contingency table. Communications in Statistics&mdash;Theory and Methods, A9, 1025&ndash;1041.
Graphical methods for categorical data. SAS User Group International Conference Proceedings, 17, 190&ndash;200. http://datavis.ca/papers/sugi/sugi17.pdf
extended association plots. Proceedings of the 3rd International Workshop on Distributed Statistical Computing, K. Hornik, F. Leisch, A. Zeileis (eds.), ISSN 1609-395X. http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/
The strucplot framework: Visualizing multi-way contingency tables with <code>vcd</code>. Journal of Statistical Software, 17(3), 1-48. URL http://www.jstatsoft.org/v17/i03/ and available as  <code>vignette("strucplot")</code>.

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

mosaic, strucplot, structable
mosaic,strucplot,structable


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


data("HairEyeColor")
## Aggregate over sex:[#合共超过性别:]
(x <- margin.table(HairEyeColor, c(1, 2)))

## Ordinary assocplot:[#普通assocplot:]
assoc(x)
## and with residual-based shading (of independence)[#和剩余的阴影(独立)]
assoc(x, main = "Relation between hair and eye color", shade = TRUE)

## Aggregate over Eye color:[#合共超过眼睛颜色:]
(x <- margin.table(HairEyeColor, c(1, 3)))
chisq.test(x)
assoc(x, main = "Relation between hair color and sex", shade = TRUE)

# Visualize multi-way table[可视化的多路表]
assoc(aperm(HairEyeColor), expected = ~ (Hair + Eye) * Sex,
      labeling_args = list(just_labels = c(Eye = "left"),
                           offset_labels = c(right = -0.5),
                           offset_varnames = c(right = 1.2),
                           rot_labels = c(right = 0),
                           tl_varnames = c(Eye = TRUE))
)

assoc(aperm(UCBAdmissions), expected = ~ (Admit + Gender) * Dept, compress = FALSE,
      labeling_args = list(abbreviate = c(Gender = TRUE), rot_labels = 0)
)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-27 10:41 , Processed in 0.025991 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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