[R] Question about which kind of plot to use
Deepayan Sarkar
deepayan.sarkar at gmail.com
Thu Dec 20 01:40:37 CET 2007
On 12/19/07, Dylan Beaudette <dylan.beaudette at gmail.com> wrote:
> On Wednesday 19 December 2007, Max wrote:
> > Hi Everyone,
> >
> > I've got a question about data representation. I have some psychometric
> > data with 5 scores for 15 different groups. I've been asked to show
> > some kind of mean plots. The data below is the mean and SD for a given
> > group, unfortunately my employer doesn't want me posting full datasets.
> >
> > :(
> >
> > The groups V,W,X,Y,Z are divided into Bottom, (B), Middle (M) and Top
> > (T). An example of my data is shown below.
> >
> > Score 1
> > Mean SD
> > B M T B M T
> > V 86.9 13.0 88.8 16.9 2.0 10.5
> > W 16.1 96.1 17.7 2.2 4.6 1.7
> > X 50.7 61.1 74.7 4.7 3.7 7.6
> > Y 68.5 99.7 37.6 6.0 8.0 2.3
> > Z 92.7 22.3 69.4 6.5 1.2 2.2
> >
> > What I did before was a standard mean plot:
> >
> > plotMeans(w$score1, w$Factor,
> > error.bars="sd",xlab="Factor",ylab="Score",main="Group W Score 1 Plot")
> >
> > However, with 15 groups and 5 scores this turns into 75 individual
> > graphs. Is there a way to layer mean plots? Or show several mean plots
> > in the Same graph? Any ideas or suggestions would be great.
> >
> > thanks,
> >
> > -Max
> >
>
> How about a lattice plot using panels ? plot the distribution of each score
> (box and whisker style), using a panel for each group?
>
> a <- rnorm(100)
> b <- rnorm(100)
> c <- rnorm(100)
> d <- rnorm(100)
>
> library(lattice)
> new <- make.groups(a,b,c,d
>
> new$grp <- rep(gl(5,20, labels=c('A','B','C','D','E')), 4)
>
> bwplot(data ~ which | grp, data=new)
>
> Not quite means, but close!
And
demo("intervals", package = "lattice")
shows you how to incorporate confidence intervals.
-Deepayan
More information about the R-help
mailing list