Learn R Programming

psych (version 1.0-58)

error.crosses: Plot x and y error bars

Description

Given two vectors of data, plot the means and show standard errors in both X and Y directions.

Usage

error.crosses(x, y, labels = NULL, pos = NULL, arrow.len = 0.2, ...)

Arguments

x
A vector of summary statistics (from Describe)
y
A second vector of summary statistics (also from Describe)
labels
name the pair
pos
Labels are located where with respect to the mean?
arrow.len
Arrow length
...
Other parameters for plot

Details

For an example of two way error bars describing the effects of mood manipulations upon positive and negative affect, see http://personality-project.org/revelle/publications/happy-sad-appendix/FIG.A-6.pdf

The second example shows how error crosses can be done for multiple variables where the grouping variable is found dynamically.

See Also

See Also as error.bars, error.bars.by,describe.by

Examples

Run this code
desc <- describe(attitude)
x <- desc[1,]
y <- desc[2,]
plot(x$mean,y$mean,xlab=rownames(x),ylab=rownames(y))   #in graphics window
error.crosses(x,y)    #in graphics window
#now for a bit more complicated plotting 
desc <- describe.by(attitude,(attitude[,7]>41)) #select a high and low group
g1 <- desc$'FALSE'
g2 <- desc$'TRUE'
plot(g1$mean,g2$mean,xlab = "Low Advance",ylab="High Advance",xlim=c(30,80),ylim=c(50,80))
error.crosses(g1,g2,labels=rownames(g1),pos=rep(1,7))
title("Attitudes grouped by high and low scores on Advance")

Run the code above in your browser using DataLab