Plots cell means for a numeric variable in each category of a factor or in each combination of categories of two factors, optionally along with error bars based on cell standard errors or standard deviations.
plotMeans(response, factor1, factor2,
error.bars = c("se", "sd", "conf.int", "none"),
level=0.95, xlab=deparse(substitute(factor1)),
ylab=paste("mean of", deparse(substitute(response))),
legend.lab=deparse(substitute(factor2)),
legend.pos=c("farright", "bottomright", "bottom", "bottomleft",
"left", "topleft", "top", "topright", "right", "center"),
main="Plot of Means",
pch=1:n.levs.2, lty=1:n.levs.2, col=palette(), connect=TRUE, ...)
The function invisibly returns NULL
.
Numeric variable for which means are to be computed.
Factor defining horizontal axis of the plot.
If present, factor defining profiles of means
If "se"
, the default, error bars around means
give plus or minus one standard error of the mean; if "sd"
, error
bars give plus or minus one standard deviation; if "conf.int"
, error
bars give a confidence interval around each mean; if "none"
, error
bars are suppressed.
level of confidence for confidence intervals; default is .95
Label for horizontal axis.
Label for vertical axis.
Label for legend.
Position of legend; if "farright"
(the default), extra space is left at the right of the plot.
Label for the graph.
Plotting characters for profiles of means.
Line types for profiles of means.
Colours for profiles of means
connect profiles of means, default TRUE
.
arguments to be passed to plot
.
John Fox jfox@mcmaster.ca
if (require(car)){
data(Moore)
with(Moore, plotMeans(conformity, fcategory, partner.status, ylim=c(0, 25)))
}
Run the code above in your browser using DataLab