interaction.plot(stats)
interaction.plot()所属R语言包:stats
Two-way Interaction Plot
双向互动剧情
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Plots the mean (or other summary) of the response for two-way combinations of factors, thereby illustrating possible interactions.
图平均(或其他摘要)双向组合因素的反应,从而说明可能的相互作用。
用法----------Usage----------
interaction.plot(x.factor, trace.factor, response, fun = mean,
type = c("l", "p", "b", "o", "c"), legend = TRUE,
trace.label = deparse(substitute(trace.factor)),
fixed = FALSE,
xlab = deparse(substitute(x.factor)),
ylab = ylabel,
ylim = range(cells, na.rm=TRUE),
lty = nc:1, col = 1, pch = c(1:9, 0, letters),
xpd = NULL, leg.bg = par("bg"), leg.bty = "n",
xtick = FALSE, xaxt = par("xaxt"), axes = TRUE,
...)
参数----------Arguments----------
参数:x.factor
a factor whose levels will form the x axis.
将形成一个因素,其水平的X轴。
参数:trace.factor
another factor whose levels will form the traces.
另一个因素,其水平将形成的痕迹。
参数:response
a numeric variable giving the response
一个数字变量,给予回应
参数:fun
the function to compute the summary. Should return a single real value.
函数来计算的总结。应该返回一个单一的实际价值。
参数:type
the type of plot (see plot.default): lines or points or both.
图类型(见plot.default):线或点或两者兼而有之。
参数:legend
logical. Should a legend be included?
逻辑。应该被列入传说呢?
参数:trace.label
overall label for the legend.
传说中的整体标签。
参数:fixed
logical. Should the legend be in the order of the levels of trace.factor or in the order of the traces at their right-hand ends?
逻辑。应该是传说中的水平trace.factor顺序,或为了在他们的右手两端的痕迹?
参数:xlab,ylab
the x and y label of the plot each with a sensible default.
x和y的积的标签每一个明智的默认。
参数:ylim
numeric of length 2 giving the y limits for the plot.
长度为2的数字图的Y限制。
参数:lty
line type for the lines drawn, with sensible default.
线画线的类型,合理的默认。
参数:col
the color to be used for plotting.
将用于绘图的颜色。
参数:pch
a vector of plotting symbols or characters, with sensible default.
符号或字符,矢量绘制合理的默认。
参数:xpd
determines clipping behaviour for the legend used, see par(xpd). Per default, the legend is not clipped at the figure border.
确定裁剪行为legend,请参阅par(xpd)。每默认情况下,传说是不是在图边框裁剪。
参数:leg.bg, leg.bty
arguments passed to legend().
参数传递到legend()。
参数:xtick
logical. Should tick marks be used on the x axis?
逻辑。应x轴刻度?
参数:xaxt, axes, ...
graphics parameters to be passed to the plotting routines.
图形参数被传递到绘图程序。
Details
详情----------Details----------
By default the levels of x.factor are plotted on the x axis in their given order, with extra space left at the right for the legend (if specified). If x.factor is an ordered factor and the levels are numeric, these numeric values are used for the x axis.
默认情况下,各级x.factor被绘制在X轴在其给定的顺序,留下的传说,在右边(如果指定)的额外空间。 x.factor如果是一个有序的因素和水平是数字,这些数字值用于x轴。
The response and hence its summary can contain missing values. If so, the missing values and the line segments joining them are omitted from the plot (and this can be somewhat disconcerting).
响应,因此其摘要可以包含缺失值。如果是这样,遗漏值和线段加入他们的图省略(这可有点不安)。
The graphics parameters xlab, ylab, ylim, lty, col and pch are given suitable defaults (and xlim and xaxs are set and cannot be overridden). The defaults are to cycle through the line types, use the foreground colour, and to use the symbols 1:9, 0, and the capital letters to plot the traces.
图形参数xlab,ylab,ylim,lty,col和pch(xlim合适的默认值, xaxs设置不能被覆盖)。默认值是循环通过行类型,使用前景色,使用符号1:9 0,大写字母绘制的痕迹。
注意----------Note----------
Some of the argument names and the precise behaviour are chosen for S-compatibility.
一些选择的S-兼容的参数名称和确切的行为。
参考文献----------References----------
Analysis of variance; designed experiments. Chapter 5 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
举例----------Examples----------
require(graphics)
with(ToothGrowth, {
interaction.plot(dose, supp, len, fixed=TRUE)
dose <- ordered(dose)
interaction.plot(dose, supp, len, fixed=TRUE, col = 2:3, leg.bty = "o")
interaction.plot(dose, supp, len, fixed=TRUE, col = 2:3, type = "p")
})
with(OrchardSprays, {
interaction.plot(treatment, rowpos, decrease)
interaction.plot(rowpos, treatment, decrease, cex.axis=0.8)
## order the rows by their mean effect[#命令行,他们的平均效果]
rowpos <- factor(rowpos,
levels = sort.list(tapply(decrease, rowpos, mean)))
interaction.plot(rowpos, treatment, decrease, col = 2:9, lty = 1)
})
with(esoph, {
interaction.plot(agegp, alcgp, ncases/ncontrols, main = "'esoph' Data")
interaction.plot(agegp, tobgp, ncases/ncontrols, trace.label="tobacco",
fixed=TRUE, xaxt = "n")
})
## deal with NAs:[#处理与NAS:]
esoph[66,] # second to last age group: 65-74[第二个到最后一个年龄组:65-74]
esophNA <- esoph; esophNA$ncases[66] <- NA
with(esophNA, {
interaction.plot(agegp, alcgp, ncases/ncontrols, col= 2:5)
# doesn't show *last* group either[不显示*最后*组任]
interaction.plot(agegp, alcgp, ncases/ncontrols, col= 2:5, type = "b")
## alternative take non-NA's {"cheating"}[#采取替代非NA的“作弊”}]
interaction.plot(agegp, alcgp, ncases/ncontrols, col= 2:5,
fun = function(x) mean(x, na.rm=TRUE),
sub = "function(x) mean(x, na.rm=TRUE)")
})
rm(esophNA) # to clear up[清理]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|