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

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

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

                                        Extended Mosaic Plots
                                         扩展马赛克图

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

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

Plots (extended) mosaic displays.
图(扩展)的拼接显示。


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


## Default S3 method:[默认方法]
mosaic(x, condvars = NULL,
  split_vertical = NULL, direction = NULL, spacing = NULL,
  spacing_args = list(), gp = NULL, expected = NULL, shade = NULL,
  highlighting = NULL, highlighting_fill = grey.colors, highlighting_direction = NULL,
  zero_size = 0.5, zero_split = FALSE, zero_shade = NULL,
  zero_gp = gpar(col = 0), panel = NULL, main = NULL, sub = NULL, ...)
## S3 method for class 'formula'[类formula的方法]
mosaic(formula, data, highlighting = NULL,
  ..., main = NULL, sub = NULL, subset = NULL, na.action = NULL)



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

参数:x
a contingency table in array form, with optional category labels specified in the dimnames(x) attribute, or an object of class "structable".
列联表数组的形式,与可选的类别标签中指定的dimnames(x)属性,或对象类"structable"。


参数:condvars
vector of integers or character strings indicating conditioning variables, if any. The table will be permuted to order them first.
向量的整数或字符串显示调节变量,如果有的话。该表将被排列第一对它们进行排序。


参数:formula
a formula specifying the variables used to create a  contingency table from data.  For convenience, conditioning formulas can be specified; the conditioning variables will then be used first for splitting. If any, a specified response variable will be highlighted in the cells.
公式指定使用的变量,创建一个列联表data。为方便起见,可以指定空调的公式将被用于第一个分裂的调节变量。如果有的话,指定的响应变量将被突出显示单元格中。


参数:data
either a data frame, or an object of class "table" or "ftable".
一个数据框,或对象类"table"或"ftable"的。


参数:subset
an optional vector specifying a subset of observations to be used.
一个可选的向量指定要使用的观测值的一个子集。


参数:na.action
a function which indicates what should happen when the data contain NAs. Ignored if data is a contingency table.
一个函数,它表示当数据包含NA的,应该发生什么。如果忽略data是一个列联表。


参数:zero_size
size of the bullets used for zero entries (if 0, no bullets are drawn).
零条目(如果为0,没有子弹画)所使用的子弹的大小。


参数:zero_split
logical controlling whether zero cells should be further split. If FALSE and zero_shade is FALSE, only one bullet is drawn (centered) for unsplit zero cells. If FALSE and zero_shade is TRUE, a bullet for each zero cell is drawn to allow, e.g., residual-based shadings to be effective also for zero cells.
逻辑控制零单元是否应进一步分裂。如果FALSE和zero_shade是FALSE,只有一颗子弹的绘制(中心)未拆分的零单元。如果FALSE和zero_shade是TRUE,每个零单元被吸引到允许的子弹,例如,剩余的阴影是有效的零单元。


参数:zero_shade
logical controlling whether zero bullets should be shaded. The default is TRUE if shade is TRUE or expected is not null or gp is not null, and FALSE otherwise.
逻辑控制零子弹是否应该阴影。默认值是TRUE如果shade是TRUE或expected是不为空或gp是不为空,并FALSE否则。


参数:zero_gp
object of class "gpar" used for zero bullets in case they are not shaded.
类的对象"gpar"零子弹的情况下,他们没有阴影。


参数: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 tile(s) of the corresponding dimension should be split vertically, FALSE means horizontal splits. Ignored if direction is not NULL.
向量,逻辑值的长度k,其中k的利润是多少x(默认:FALSE)。价值被回收作为需要。 ATRUE组件的相应尺寸的瓷砖(S)应垂直分割,:FALSE是指水平分割。如果direction非NULL忽略。


参数:direction
character vector of length k, where k is the number of margins of x (values are recycled as needed). For each component, a value of "h" indicates that the tile(s) of the corresponding dimension should be split horizontally, whereas "v" indicates vertical split(s).
字符向量的长度k,k的利润是多少x(值被回收如需要)。对于每个组件,值"h"表明瓷砖(s)的对应的维度应水平分割,而"v"表示垂直分割()。


参数:spacing
spacing object, spacing function, or corresponding generating function (see strucplot for more information). The default is spacing_equal if x has two dimensions, spacing_increase for more dimensions, and spacing_conditional if conditioning variables are specified using condvars or the formula interface.
间隔对象,间距功能,或相应的生成函数(见strucplot的详细信息)。默认值是spacing_equal如果x有两个尺寸,spacing_increase更多的维度,和spacing_conditional,如果调节变量使用condvars或公式接口。


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


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


参数: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 (see strucplot) is specified, a corresponding conditional independence model, and else the total independence model.
逻辑指定是否gp应使用或没有(见gp)。如果TRUE和expected是不确定的,默认的模型安装:如果condvars(见strucplot),相应的条件独立的模型,和其他的完全独立的模型。


参数: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 strucplot).
可选的阵列尺寸相同的预期值x,或者相应的独立型号规格所用的loglin或loglm(见strucplot)。


参数:highlighting
character vector or integer specifying a variable to be highlighted in the cells.
矢量字符或整数,指定一个变量,需要强调的单元。


参数:highlighting_fill
color vector or palette function used for a highlighted variable, if any.
颜色矢量,调色板功能用于高亮显示的变量,如果有的话。


参数:highlighting_direction
Either "left", "right", "top", or "bottom" specifying the direction of highlighting in the cells.
无论是"left","right","top"或"bottom"指定在单元中的突出方向。


参数:panel
Optional function with arguments: residuals, observed, expected, index, gp, and name called by the struc_mosaic workhorse for each tile that is drawn in the mosaic. index is an integer vector with the tile's coordinates in the contingency table, gp a gpar object for the tile, and name a label to be assigned to the drawn grid object.
可选的功能与参数:residuals,observed,expected,index,gp和name称为struc_mosaic主力的每瓦,在镶嵌画。 index是一个整数的向量,与瓷砖的应急表中的坐标,gp一个gpar对象为瓷砖,name一个标签被分配到的拉伸栅格对象。


参数: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 arguments passed to strucplot
其他参数传递给strucplot


Details

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

Mosaic displays have been suggested in the statistical literature by Hartigan and Kleiner (1984) and have been extended by Friendly (1994). mosaicplot is a base graphics implementation and mosaic is a much more flexible and extensible grid implementation.
哈蒂根和Kleiner(1984),马赛克显示在统计文献中已经提出,并已延伸活动(1994年)。 mosaicplot是一个基本图形的实施和mosaic是一个更灵活的和可扩展的网格实施。

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

A mosaic plot is an area proportional visualization of a (possibly higher-dimensional) table of expected frequencies.  It is composed of tiles (corresponding to the cells) created by recursive vertical and horizontal splits of a square.  The area of each tile is proportional to the corresponding cell entry, given the dimensions of previous splits.
马赛克图是一个面积比例可视化的预期频率(高维)表。它创建的递归垂直和水平分割一个正方形的瓷砖(对应于单元)组成。每一瓦片的面积正比于相应的单元格条目,先前分割给定的尺寸。

An extended mosaic plot, in addition, visualizes the fit of a particular log-linear model. Typically, this is done by residual-based shadings where color and/or outline of the tiles visualize sign, size and possibly significance of the corresponding residual.
扩展镶嵌图,此外,可视化的对数线性模型的拟合。通常情况下,这是通过基于剩余的着色,颜色和/或轮廓的瓷砖可视化标志,尺寸和可能的意义,相应的剩余。

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

In contrast to the mosaicplot function in graphics, the splits start with the horizontal direction by default to match the printed output of structable.
相反的mosaicplot的功能,graphics,分裂与水平方向开始默认情况下,匹配的打印输出structable。


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

A mosaic of television ratings. The American Statistician, 38, 32&ndash;35.
Mosaic displays in S-PLUS: A general implementation and a case study. Statistical Computing and Graphics Newsletter (ASA), 9, 1, 17&ndash;23.
Mosaic displays for multi-way contingency tables. Journal of the American Statistical Association, 89, 190&ndash;200.
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", package = "vcd")</code>.
(http://datavis.ca) provides information on various aspects of graphical methods for analyzing categorical data, including mosaic plots. In particular, there are many materials for his course &ldquo;Visualizing Categorical Data with SAS and R&rdquo; at http://datavis.ca/courses/VCD/.

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

assoc, strucplot, mosaicplot, structable, doubledecker
assoc,strucplot,mosaicplot,structable,doubledecker


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


data("Titanic")
mosaic(Titanic)

## Formula interface for tabulated data plus shading and legend:[#公式的表格数据接口加上阴影和传说:]
mosaic(~ Sex + Age + Survived, data = Titanic,
  main = "Survival on the Titanic", shade = TRUE, legend = TRUE)

data("HairEyeColor")
mosaic(HairEyeColor, shade = TRUE)
## Independence model of hair and eye color and sex.  Indicates that[#独立模型的头发和眼睛的颜色和性别。表示]
## there are significantly more blue eyed blond females than expected[#有明显更蓝眼睛的金发女性高于预期]
## in the case of independence (and too few brown eyed blond females).[#独立的情况下(和太少的棕色眼睛的金发女)。]

mosaic(HairEyeColor, shade = TRUE, expected = list(c(1,2), 3))
## Model of joint independence of sex from hair and eye color.  Males[#型号的联合独立的性别,头发和眼睛的颜色。男性]
## are underrepresented among people with brown hair and eyes, and are[#人民之间有着棕色的头发和眼睛的代表性不足,并且]
## overrepresented among people with brown hair and blue eyes, but not[#棕色头发,蓝眼睛的人所占比例过高,但不]
## "significantly".[#“显著”。]

## Formula interface for raw data: visualize crosstabulation of numbers[#式接口,原始数据:交叉表的数字可视化]
## of gears and carburettors in Motor Trend car data.[#齿轮和化油器汽车发展趋势的汽车数据。]
data("mtcars")
mosaic(~ gear + carb, data = mtcars, shade = TRUE)

data("reSex")
mosaic(PreSex, condvars = c(1,4))
mosaic(~ ExtramaritalSex + PremaritalSex | MaritalStatus + Gender,
       data = PreSex)

## Highlighting:[#强调:]
mosaic(Survived ~ ., data = Titanic)

data("Arthritis")
mosaic(Improved ~ Treatment | Sex, data = Arthritis, zero_size = 0)
mosaic(Improved ~ Treatment | Sex, data = Arthritis, zero_size = 0, highlighting_direction = "right")

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-27 08:36 , Processed in 0.031291 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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