Learn R Programming

multicon (version 1.1)

diffPlot: Difference Plot

Description

A function for creating a Difference Plot between two groups.

Usage

diffPlot(DV, grp, plotFUN = mean, errFUN = c("ci", "se", "sd"), 
	conf = 0.95, grp.names = NULL, var.equal = FALSE, ...)

Arguments

DV
A numeric variable containing raw scores to be summarized in the plot.
grp
A single variable with exactly two levels indicating the grouping factor.
plotFUN
The function used to create the summary statistic. Usually mean is desired.
errFUN
A character element indicating the type of error bars to be calculated. There are four possible choices: "ci" (the default) uses a confidence interval for the mean with level indicated by the conf= argument. "se" uses 1 Standard Error from the mean. "sd"
conf
A numeric indicating the desired level of confidence if type "ci" is used for the errFUN argument.
grp.names
A character vector of length 2 providing the names for the two different groups (conditions).
var.equal
A logical indicating whether it should be assumed that the variances of the two groups on the DV are equal. Defaults to FALSE.
...
Other arguments passed to the plot() and axis() functions including graphing parameters (e.g. 'ylim', 'col').

Details

This function creates a two-group difference plots with error bars using raw data as input. This is a preferred way of graphical displaying group means that are directly compared (rather than bargraphs) because it provides information about the estimated size of the difference and the accuracy of that estimate (Cumming, 2012).

References

Cumming, G. (2012). Understanding the New Statistics: Effect Sizes, Confidence Intervals, and Meta-Analysis. New York: Routledge.

See Also

bargraph egraph

Examples

Run this code
y <- rnorm(100)
g <- rep(1:2, each=50)
diffPlot(y, g, ylab="DV", xlab="", main="Plot of Means with Floating Axis for Mean Difference", 
grp.names=c("Control", "Experimental"), sub="Arms Indicate 95 Percent CIs")

Run the code above in your browser using DataLab