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

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

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

                                        Structured Displays of Contingency Tables
                                         结构性显示的列联表

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

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

This modular function visualizes certain aspects of high-dimensional contingency tables in a hierarchical way.
这种模块化功能的可视化分层方式在某些方面的高维列联表。


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


strucplot(x, residuals = NULL, expected = NULL,
  condvars = NULL, shade = NULL, type = c("observed", "expected"),
  residuals_type = NULL, df = NULL, split_vertical = NULL,
  spacing = spacing_equal, spacing_args = list(),
  gp = NULL, gp_args = list(),
  labeling = labeling_border, labeling_args = list(),
  core = struc_mosaic, core_args = list(),
  legend = NULL, legend_args = list(),
  main = NULL, sub = NULL, margins = unit(3, "lines"),
  title_margins = NULL, legend_width = NULL,
  main_gp = gpar(fontsize = 20), sub_gp = gpar(fontsize = 15),
  newpage = TRUE, pop = TRUE, keep_aspect_ratio = NULL, prefix = "", ...)



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

参数:x
a contingency table in array form, with optional category labels specified in the dimnames attribute.
联表数组的形式,dimnames属性中指定的可选的分类标签。


参数:residuals
optionally, an array of residuals of the same dimension as x (see details).
可选的阵列的尺寸相同x(见详情)的残留物。


参数:expected
optionally, an array of expected values of the same dimension as x, or alternatively the corresponding independence model specification as used by loglin or loglm (see details).
可选的阵列的预期值相同的尺寸,x,或者相应的的独立型号规格所用的loglin或loglm(见详情)。


参数:df
degrees of freedom passed to the shading functions used for inference. Will be calculated (and overwritten if specified) if both expected and residuals are NULL, or if expected is given a formula.
自由度传递给用于推理的遮光功能。将计算(和覆盖如果指定的话),如果两个expected和residuals是NULL,或如果expected公式。


参数:condvars
number of conditioning variables, if any; those are expected to be ordered first in the table. This information is used for computing the expected values, and is also passed to the spacing functions (see spacings).
条件变量的数目,如果有的话;那些预期要首先在表中排列的。此信息是用于计算的预期值,并且也被传递给的间距的功能(见spacings)。


参数:shade
logical specifying whether gp should be used or not (see gp). If TRUE and expected is unspecified, a default model is fitted: if condvars is specified, a corresponding conditional independence model, and else the total independence model.
逻辑指定是否gp应使用或没有(见gp)。如果TRUE和expected是不确定的,一个默认的模型安装:如果condvars指定相应的条件独立的模型,和其他的完全独立的模型。


参数:residuals_type
a character string indicating the type of residuals to be computed when none are supplied. If residuals is NULL, residuals_type must be one of "pearson" (default; giving components of Pearson's chi-squared), "deviance" (giving components of the likelihood ratio chi-squared), or "FT" for the Freeman-Tukey residuals. The value of this argument can be abbreviated. If residuals are specified, the value of residuals_type is just passed “as is” to the legend function.
一个字符串类型的残差计算时没有提供。如果residuals是NULL,residuals_type是"pearson"(默认给Pearson的卡方的组件),"deviance"(给部件的可能性比卡方),或"FT"的弗里曼杜克残差。这个参数的值,可以缩写。如果residuals指定residuals_type刚刚过去的“是”的传说功能。


参数:type
a character string indicating whether the observed or the expected values of the table should be visualized.
一个字符的字符串,用于指示是否观察到的或预期的表的值应该是可视化。


参数:split_vertical
vector of logicals of length k, where k is the number of margins of x (values are recycled as needed). A TRUE component indicates that the tile(s) of the corresponding dimension should be split vertically, FALSE means horizontal splits. Default is FALSE.
向量,逻辑值的长度k,其中k的利润是多少x(值被回收)。 ATRUE组件的相应尺寸的瓷砖(S)应垂直分割,:FALSE是指水平分割。默认是FALSE.


参数:spacing
spacing object, spacing function, or a corresponding generating function (see details and spacings).
间距。对象,间距函数,或对应的生成函数(见详情和spacings)。


参数:spacing_args
list of arguments for the spacing-generating function, if specified.
的间距生成函数的参数列表,如果指定的话。


参数:gp
object of class "gpar", shading function or a corresponding generating function (see details and shadings). Components of "gpar" objects are recycled as needed along the last splitting dimension. Ignored if shade = FALSE.  
对象的类"gpar",遮光功能或相应的生成函数(查看详细信息和shadings)。的组成部分"gpar"对象被回收作为需要沿着最后的分割尺寸。如果忽略shade = FALSE。


参数:gp_args
list of arguments for the shading-generating function, if specified.
阴影生成函数的参数列表,如果指定的话。


参数:labeling
either a logical, or a labeling function, or a corresponding generating function (see details and labelings. If FALSE or NULL, no labeling is produced.
无论是逻辑,或标签的功能,或相应的生成函数(见详情和labelings。如果FALSE或NULL,没有标签产生。


参数:labeling_args
list of arguments for the labeling-generating function, if specified.
的标签生成函数的参数列表,如果指定的话。


参数:core
either a core function, or a corresponding generating function (see details).  Currently, generating functions for mosaic plots (struc_mosaic), association plots (struc_assoc), and sieve plots (struc_sieve) are provided.
无论是核心功能,或对应的生成函数(见详情)。目前,产生的马赛克图(struc_mosaic),关联图(struc_assoc)和筛图(struc_sieve)提供的功能。


参数:core_args
list of arguments for the core-generating function, if specified.
核心功能的参数列表,如果指定的话。


参数:legend
either a legend-generating function, or a legend function (see details and legends), or a logical. If legend is NULL or TRUE and gp is a function, legend defaults to legend_resbased.
无论是传说的功能,或图例功能(查看详细信息和legends),或逻辑。 legend如果是NULL或TRUE和gp是一个函数,传说默认为legend_resbased。


参数:legend_args
list of arguments for the legend-generating function, if specified.
的传说生成函数的参数列表,如果指定的话。


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


参数:sub
a character string used for plotting the subtitle. If sub is a logical and TRUE and main is unspecified, the name of the object supplied as x is used.
一个字符串用于绘制的字幕。如果sub是逻辑和TRUE的和main是不确定的,x使用提供的对象的名称。


参数:margins
either an object of class "unit" of length 4, or a numeric vector of length 4. The elements are recycled as needed. The four components specify the top, right, bottom, and left margin of the plot, respectively. When a numeric vector is supplied, the numbers are interpreted as "lines" units.  In addition, the unit or numeric vector may have named arguments (top, right, bottom, and left), in which case the non-named arguments specify the default values (recycled as needed), overloaded by the named arguments.
无论是类的一个对象"unit"长度为4,或一个数值向量的长度为4。被回收作为需要的元素。的四个组成部分指定的顶部,右,底部,和左边缘的图。当一个数值向量被提供时,被解释为数字"lines"单位。此外,已命名的单位或数字矢量参数(top,right,bottom和left),在这种情况下,非参数指定默认值超载的命名参数的值(如需要回收),。


参数:title_margins
either an object of class "unit" of length 2, or a numeric vector of length 2. The elements are recycled as needed. The two components specify the top and bottom title margin of the plot, respectively. The default for each specified title are 2 lines (and 0 else), except when a legend is plotted and keep_aspect_ratio is TRUE: in this case, the default values of both margins are set as to align the heights of legend and actual plot. When a numeric vector is supplied, the numbers are interpreted as "lines" units.  In addition, the unit or numeric vector may have named arguments (top and bottom), in which case the non-named argument specify the default value (recycled as needed), overloaded by the named arguments.
无论是类的一个对象"unit"长度为2,或一个数字的矢量的长度为2。被回收作为需要的元素。这两个组件指定的顶部和底部的标题保证金的图。默认情况下,为每个指定的标题是2号线(0其他),除了当一个传说是策划和keep_aspect_ratio是TRUE:在这种情况下,左右边距的默认值设置为对齐高度的传说和实际的图。当一个数值向量被提供时,被解释为数字"lines"单位。此外,单位或数字矢量命名参数(top和bottom),在这种情况下,未命名的参数指定默认值(如需要回收),过载的命名参数。


参数:legend_width
An object of class "unit" of length 1 specifying the width of the legend (if any). Default: 5 lines.
对象的类"unit"长度为1的指定宽度的传说(如有)。默认值:5号线。


参数:pop
logical indicating whether the generated viewport tree should be removed at the end of the drawing or not.
逻辑指示是否应被删除在绘图或不结束所产生的视口树。


参数:main_gp, sub_gp
object of class "gpar" containing the graphical parameters used for the main (sub) title, if specified.
类的对象"gpar"包含的图形参数,如果指定用于主(分)标题。


参数:newpage
logical indicating whether a new page should be created for the plot or not.
逻辑表明的图或是否应该创建一个新的页面。


参数:keep_aspect_ratio
logical indicating whether the aspect ratio should be fixed or not. If unspecified, the default is TRUE for two-dimensional tables and FALSE otherwise.
逻辑表示的纵横比是否应该是固定的或不。如果没有指定,默认是TRUE两维表和FALSE否则。


参数:prefix
optional character string used as a prefix for the generated viewport and grob names.
使用可选的字符串生成的视口和格罗名称作为前缀。


参数:...
For convenience, list of arguments passed to the labeling-generating function used.
为方便起见,传入的参数列表的标签产生功能。


Details

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

This function—usually called by higher-level functions such as assoc and mosaic—generates conditioning plots of contingency tables. First, it sets up a set of viewports for main- and subtitles, legend, and the actual plot region.  Then, residuals are computed as needed from observed and expected frequencies, where the expected frequencies are optionally computed for a specified independence model.  Finally, the specified functions for spacing, gp, main plot, legend, and labeling are called to produce the plot.  The function invisibly returns the "structable" object visualized.
此功能通常被称为更高级别的功能,如assoc和mosaic生成调节图的列联表。首先,它建立了一套主要和字幕,传说,和实际的图区域的视口。然后,需要观察的和期望的频率,在预期的频率是可以计算为一个指定的独立模型残差计算。最后,指定的函数被称为间距,糖蛋白,主要图,传说,标签的图。不可见的功能返回可视化"structable"对象。

Most elements of the plot, such as the core function, the spacing between the tiles, the shading of the tiles, the labeling, and the legend, are modularized in graphical appearance control (&ldquo;grapcon&rdquo;) functions and specified as parameters.  For each element foo (= spacing, labeling, core, or legend), strucplot takes two arguments: <VAR>foo</VAR> and <VAR>foo\_args</VAR>, which can be used to specify the parameters in the following alternative ways:
大多数元素的核心功能,之间的间距的瓷砖,地砖的阴影,标签和传说的图,比如,在图形外观控制(“grapcon”)的功能被模块化并作为参数指定。对于每一个元素美孚(=spacing,labeling,core,或legend)strucplot需要两个参数:<VAR>富</ VAR>和<VAR> foo的\ _args </变更>,它可以被用来指定的参数在下面的替代方法:

Passing a suitable function to <VAR>foo</VAR> which subsequently will be called from strucplot to compute shadings, labelings, etc.
传递合适的的功能,<VAR>富,</ VAR>随后将被称为strucplot计算阴影,标号等

Passing a corresponding generating function to <VAR>foo</VAR>, along with parameters passed to <VAR>foo\_args</VAR>, that generates such a function. Generating functions must inherit from classes "grapcon_generator" and "}<VAR>foo</VAR>\code{".
通过相应的生成函数<VAR>富</ VAR>,以及参数传递到<VAR>富\ _args </ VAR>,产生这样的功能。生成函数必须继承自类"grapcon_generator"和"}<VAR>foo</VAR>\code{"。

Except for the shading functions (<VAR>shading\_bar</VAR>), passing <VAR>foo(foo\_args)</VAR> to the <VAR>foo</VAR> argument.
除遮光功能(<VAR>阴影\ _bar </ VAR>),通过<VAR>富(富\ _args)</ VAR>到的<VAR>的富</ VAR>的说法。

For shadings and spacings, passing the final parameter object itself; see the corresponding help pages for more details on the data structures.
对于阴影和间距,通过最后一个参数对象本身,看到相应的帮助页面的详细信息的数据结构。

If legends are drawn, a "cinemascope"-like layout is used for the plot to preserve the 1:1 aspect ratio.
如果绘制的传说,“cinemascope状布局的图保持1:1的纵横比。

If type = "expected", the expected values are passed to the observed argument of the core function, and the observed values to the expected argument.
如果type = "expected",预期值是通过observed争论的核心功能,expected参数与实测值。

Although the gp argument is typically used for shading, it can be used for arbitrary modifications of the tiles' graphics parameters (e.g., for highlighting particular cells, etc.).
虽然通常用于遮光gp参数,它可以用于对任意的瓷砖的图形参数修改(例如,用于突出显示特定的单元,等)。


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

Invisibly, an object of class "structable" corresponding to the plot.
不可见的,对象类"structable"相应的图。


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

The created viewports, as well as the tiles and bullets, are named and thus can conveniently modified after a plot has been drawn (and pop = FALSE).
创建视口,以及瓷砖和子弹,被命名,因此可以很方便地修改后的图已经绘就(和pop = FALSE“)。


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



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




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

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----------

assoc, mosaic, sieve, struc_assoc, struc_sieve, struc_mosaic, structable, doubledecker, labelings, shadings, legends, spacings
assoc,mosaic,sieve,struc_assoc,struc_sieve,struc_mosaic,structable,doubledecker,labelings,shadings,legends,spacings


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


data("Titanic")

strucplot(Titanic)
strucplot(Titanic, core = struc_assoc)
strucplot(Titanic, spacing = spacing_increase,
                   spacing_args = list(start = 0.5, rate = 1.5))
strucplot(Titanic, spacing = spacing_increase(start = 0.5, rate = 1.5))

## modify a tile's color[#修改瓷砖的颜色]
strucplot(Titanic, pop = FALSE)
grid.edit("rect:Class=1st,Sex=Male,Age=Adult,Survived=Yes",
          gp = gpar(fill = "red"))

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-27 08:24 , Processed in 0.023326 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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