[R] Variability plot in R
Joseph Boyer
joseph.g.boyer at gsk.com
Wed Oct 5 22:11:30 CEST 2011
Dennis,
Thank you for your reply. This is a good start for what I want to achieve.
-- Joe
-----Original Message-----
From: Dennis Murphy [mailto:djmuser at gmail.com]
Sent: Friday, May 20, 2011 10:55 PM
To: Joseph Boyer
Cc: r-help at r-project.org
Subject: Re: [R] Variability plot in R
Here's one attempt; I only used five of the wafers since you didn't
provide any data.
dd <- data.frame(wafer = factor(rep(1:5, each = 6)),
operator = factor(rep(rep(1:3, each = 2), 5)),
thickness = c(0.62, 0.66, 0.53, 0.53, 0.51, 0.55,
0.99, 1.00, 1.05, 0.93, 1.05, 1.02,
0.82, 0.81, 0.80, 0.77, 0.90, 0.77,
0.85, 0.89, 0.83, 0.76, 0.79, 0.81,
0.59, 0.48, 0.39, 0.40, 0.46, 0.51))
# Summarize the data to output the mean, sd, min and max of thickness
library(ggplot2)
dsumm <- ddply(dd, .(wafer, operator), summarise, tmean = mean(thickness),
tmin = min(thickness), tmax = max(thickness),
tsd = sd(thickness))
# 'Multi-vari' plot:
p1 <- ggplot(dd) +
geom_point(aes(x = wafer, y = thickness)) +
geom_errorbar(data = dsumm, aes(x = wafer, y = tmean,
ymin = tmin, ymax = tmax), colour = 'blue') +
geom_segment(data = dsumm, aes(x = wafer, y = tmean, yend = tmean,
xend = as.numeric(wafer) + 0.2), colour = 'blue') +
geom_segment(data = dsumm, aes(x = wafer, y = tmean, yend = tmean,
xend = as.numeric(wafer) - 0.2), colour = 'blue') +
facet_wrap( ~ operator, nrow = 1) + xlab("")
# Standard deviation plot
p2 <- ggplot(dsumm, aes(x = wafer, y = tsd)) +
geom_point(colour = 'blue') + geom_line(aes(group = 1), size =
1, colour = 'blue') +
facet_wrap( ~ operator, nrow = 1)
# Use the gridExtra package to combine the two graphs
library(gridExtra)
grid.arrange(p1, p2)
HTH,
Dennis
On Fri, May 20, 2011 at 4:12 PM, Joseph Boyer <joseph.g.boyer at gsk.com> wrote:
> Is there a package in R that can do a variability plot?
>
> A variability plot is a kind of categorized dot plot. (If there is a lot of data in each category, box plots are used rather than dot plots.)
> Usually, the categories are factor level combinations. All the dot plots appear in the same window; below the x-axis a hierarchy of factors
> shows which dot plot corresponds to which factor-level combination.
>
> Examples can be seen
> http://statsoft.com/support/blog/entryid/64/user-defined-variability-plots/
> and
> http://www.public.iastate.edu/~wrstephe/stat495/GaugeRR_WaferThickness_JMPOutput.pdf
>
> By reordering the factor names in the function call, the user can reorder the factor level combinations on the graph, making it easier
> to do the visual comparisons of interest. The user should also have the option to draw line segments at factor level combination means/medians, and to connect the category means/medians to make visual comparison easier.
>
> The only softwares which I am aware of which produce such a plot are Statistica and JMP. I have found these plots to be more powerful than
> lattice-style categorizations in their ability to allow the user to conveniently process experimental data visually.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list