contour.lm(rsm)
contour.lm()所属R语言包:rsm
Surface plot(s) of a fitted linear model
线性模型的拟合曲面图(S)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
contour and persp methods that will work with any lm object involving two or more numerical predictors.
contour和persp方法,将与任何lm对象涉及两个或两个以上的数值的预测。
用法----------Usage----------
## S3 method for class 'lm'
contour(x, form, at, bounds, zlim, xlabs, hook,
plot.it=TRUE, atpos = 1, image=FALSE, img.col=terrain.colors(50), ...)
## S3 method for class 'lm'
image(x, form, at, bounds, zlim, xlabs, hook, atpos = 1, ...)
## S3 method for class 'lm'
persp(x, form, at, bounds, zlim, zlab, xlabs, col = "white",
contours = NULL, hook, atpos = 3, theta = -25, phi = 20, r = 4,
border = NULL, box = TRUE, ticktype = "detailed", ...)
参数----------Arguments----------
参数:x
A lm object.
Alm对象。
参数:form
A formula, or a list of formulas.
一个公式或公式的列表。
参数:at
Optional named list of fixed values to use for surface slices. For example, if the predictor variables are x1, x2, and x3, the contour plot of x2 versus x1 would be based on the fitted surface sliced at the x3 value specified in at; the contour plot of x3 versus x1 would be sliced at the at value for x2; etc. If not provided, at defaults to the mean value of each numeric variable, and the first level of each factor.
可选命名为固定值,使用面片。例如,如果预测变量是x1,x2和x3,等高线图x2与x1将根据安装面切片在x3中指定的值at;等高线图x3与x1将切片在at等x2值如果未提供,at默认为每个数值变量的平均值,并各因素的第一级。
参数:bounds
Optional named list of bounds or grid values to use for the variables having the same names. See details.
可选的边界或网格值使用的变量具有相同的名称命名列表。查看详细信息。
参数:zlim
Optional zlim setting passed to image. If not provided, the range of values across all plotted surfaces is used.
通过可选的zlim到image。如果没有提供,在所有绘制表面的值的范围。
参数:zlab
Optional label for the vertical axis.
垂直轴可选标签。
参数:xlabs
Alternate labels for predictor axes (see Details).
预测轴的替代标签(见详情)。
参数:hook
Optional list that can contain functions pre.plot and post.plot. May be used to add annotations or to re-route the graphs to separate files (see Details).
可选列表,可以包含功能pre.plot和post.plot。可用于添加注释或重新路由到单独的文件中的图表(见详情)。
参数:atpos
Determines where at values are displayed. A value of 1 (or 2) displays it as part of the x (or y) axis label. A value of 3 displays it as a subtitle below the plot. A value of 0 suppresses it. Any other nonzero value will cause the label to be generated but not displayed; it can be accessed via a hook function.
确定at值的显示。值为1(或2)显示的X(或Y)轴标签的一部分。值3,它作为副标题在图形的下方显示。如果值为0,抑制它。任何其他非零值,将导致标签的产生,但不显示,它可以通过hook函数访问。
参数:image
Set to TRUE if you want an image plot overlaid by contours.
设置为TRUE如果你想覆盖的轮廓图像图。
参数:img.col
Color map to use when image=TRUE.
彩色图时使用的image=TRUE。
参数:plot.it
If TRUE, no plot is produced, just the return value.
如果TRUE,没有图,只是返回的值。
参数:col
Color or colors used for facets in the perspective plot (see details).
使用颜色或颜色方面的角度图(见详情)。
参数:contours
If non-NULL, specifications for added contour lines in perspective plot.
如果非NULL,规格的轮廓线透视图。
参数:theta, phi
Viewing angles passed to persp (different defaults).
可视角度传递给persp(默认值)。
参数:r
Viewing distance passed to persp (different default).
可视距离传递给persp(不同的默认值)。
参数:border, box
Options passed to persp.
选项传递到persp。
参数:ticktype
Option passed to persp (different default).
选项传递给persp不同的默认。
参数:...
Additional arguments passed to contour or persp.
额外的参数传递给contour或persp。
Details
详细信息----------Details----------
form may be a single formula or a list of formulas. A simple formula like x2 ~ x1 will produce a contour plot of the fitted regression surface for combinations of x2 (vertical axis) and x1 (horizontal axis). A list of several such simple formulas will produce a contour plot for each formula. A two-sided formula produces contour plots for each left-hand variable versus each right-hand variable (except when they are the same); for example, x1+x3 ~ x2+x3 is equivalent to list(x1~x2, x3~x2, x1~x3). A one-sided formula produces contour plots for each pair of variables. For example, ~ x1+x2+x3 is equivalent to list(x2~x1, x3~x1, x3~x2).
form可以是单一的公式或公式列表。一个简单的公式,如x2 ~ x1会产生组合的拟合回归表面的等高线图x2(垂直轴)和x1(水平轴)。列表等几个简单的公式,每个公式会产生等高线图。一个双面的公式产生等高线图,每个左边的变量与每个右手变量,(除非它们是相同的);,例如,x1+x3 ~ x2+x3相当于list(x1~x2, x3~x2, x1~x3)。是一种片面的公式为每对变量的等高线图。例如,~ x1+x2+x3是相当于list(x2~x1, x3~x1, x3~x2)。
For any variables not in the bounds argument, a grid of 26 equally-spaced values in the observed range of that variable is used. If you specify a vector of length 2, it is interpreted as the desired range for that variable and a grid of 26 equally-spaced points is generated. If it is a vector of length 3, the first two elements are used as the range, and the third as the number of grid points. If it is a vector of length 4 or more, those values are used directly as the grid values.
对于任何变量不是在bounds参数,一个网格26的等距所观察到的范围内,该变量的值。如果指定的长度为2的向量,它被解释为那个变量和等距点产生的网格26的所需的范围。如果它是一个长度为3的矢量,使用的前两个元素的范围内,并作为网格点的数目的三分之一。如果它是一个长度为4个或更多的向量,这些值将被直接用作网格值。
By default, the predictor axes are labeled using the variable names in form, unless x is an rsm object, in which case the variable-coding formulas, if present, are used to generate axis labels. These labels are replaced by the entries in xlabs if provided. One must be careful using this to make sure that the names are mapped correctly. The entries in xlabs should match the respective unique variable names in form, after sorting them in (case-insensitive) alphabetical order. Note that if form is changed, it may also be necessary to change xlabs.
缺省情况下,预测值轴使用中的变量名标记form,除非x是一个rsm对象,在这种情况下,可变编码的公式,如果存在的话,是用于生成轴标签。这些标签被替换xlabs如果提供的项目。我们必须要小心使用,以确保正确的名称映射。在xlabs应符合各自独特的变量名form后,他们(不区分大小写)按字母顺序排序。注意,如果form被改变,它也可能是必要的改变xlabs。
In persp, contour lines may be added via the contours argument. It may be a boolean or character value, or a list. If boolean and TRUE, default black contour lines are added to the bottom surface of the box. Character values of "top", "bottom" add black contour lines to the specified surface of the box. contours = "colors" puts contour lines on the bottom using the same colors as those at the same height on the surface. Other character values of contours are taken to be the desired color of the contour lines, plotted at the bottom. If contours is a list, its elements (all are optional) are used as follows:
在persp,等高线可能会通过添加contours参数。这可能是一个布尔值或字符值,或list。如果布尔和TRUE,默认的黑色轮廓线添加到盒子的底面。字符值"top","bottom"添加到指定长方体表面的黑色轮廓线。 contours = "colors"将那些在同一高度上的表面上使用相同的颜色的底部上的等高线。其他字符值contours的轮廓线所需的颜色,绘制在底部。如果contours是list,它的元素(都是可选),如下:
z Height where the contour lines are plotted. May be "bottom" (default), "top", or a numeric value.
z高度轮廓线绘制。可能"bottom"(默认),"top",或数值。
col Color of the lines. If not specified, they will be black.
col颜色的线条。如果没有指定,他们将是黑色的。
lwd Line width; default is 1.
lwd线宽度,默认为1。
Since these functions often produce several plots, the hook argument is provided if special setups or annotations are needed for each plot. It should be a list that defines one or both of the functions pre.plot and post.plot. Both of these functions have one argument, the character vector labs for that plot (see Value documentation).
由于这些功能往往会产生几个图,hook参数,如果每个小区所需要的特殊设置或注释。它应该是一个列表,该列表定义的一个或两个的功能pre.plot和post.plot。这两个函数有一个参数,一个字符向量labs,图(见价值的文档)。
Additional examples and discussion of these plotting functions is available via vignette("rsm-plots").
其他例子和讨论这些绘图功能是可以通过vignette("rsm-plots")。
值----------Value----------
A list containing information that is plotted. Each list item is itself a list with the following components:
Alist包含的信息绘制。每个列表项本身就是一个list以下组件:
参数:x, y
The values used for the x and y axes
所使用的值的x和y轴的
参数:z
The matrix of fitted response values
拟合响应值的矩阵
参数:labs
Character vector of length 5: Elements 1 and 2 are the x and y axis labels, elements 3 and 4 are their original variable names, and element 5 is the slice label (empty if atpos is 0)
字符的矢量长度为5:元件1和2的x和y坐标轴标签,元件3和4是原来的变量名,和元件5是切片标签(空如果atpos为0)
参数:zlim
The computed or provided zlim values
计算或提供zlim值
参数:transf
(persp only) The 3D transformation for trans3d
(persp)trans3d 3D转换
(作者)----------Author(s)----------
Russell V. Lenth
参考文献----------References----------
Journal of Statistical Software, 32(7), 1–17. http://www.jstatsoft.org/v32/i07/.
参见----------See Also----------
contour
contour
实例----------Examples----------
library (rsm)
heli.rsm = rsm (ave ~ block + SO(x1, x2, x3, x4), data = heli)
# Plain contour plots[平原等高线图]
par (mfrow = c (2,3))
contour (heli.rsm, ~x1+x2+x3+x4, at=canonical(heli.rsm)$xs)
# Same but with image overlay, slices at origin and block 2,[相同的,但与图像叠加,切片的起源和2座,]
# and no slice labeling[没有片的标签]
contour (heli.rsm, ~x1+x2+x3+x4, at=list(block="2"), atpos=0, image=TRUE)
# Default perspective views[默认透视图]
persp (heli.rsm, ~x1+x2+x3+x4, at=canonical(heli.rsm)$xs)
# Same plots, souped-up with facet coloring and axis labeling[同样的图,增强方面的着色和坐标轴标签]
persp (heli.rsm, ~x1+x2+x3+x4, contours="col", col=rainbow(40), at=canonical(heli.rsm)$xs,
xlabs = c("Wing area", "Wing length", "Body width", "Body length"), zlab = "Flight time")
## Not run: [#不运行:]
### Hints for creating graphics files for use in publications...[##在出版物中使用的图形文件的提示...]
# Save perspective plots in one PDF file (will be six pages long)[在一个PDF文件中保存的角度图(六页长)]
pdf(file = "heli-plots.pdf")
persp (heli.rsm, ~x1+x2+x3+x4, at=canonical(heli.rsm)$xs)
dev.off()
# Save perspective plots in six separate PNG files[在6个单独的PNG文件保存角度图]
png.hook = list()
png.hook$pre.plot = function(lab)
png(file = paste(lab[3], lab[4], ".png", sep = ""))
png.hook$post.plot = function(lab)
dev.off()
persp (heli.rsm, ~x1+x2+x3+x4, at=canonical(heli.rsm)$xs, hook = png.hook)
## End(Not run) [#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|