Skip to content
Prev 301384 / 398506 Next

Error Bars ggplot2

Hi Dennis,

Part of my problem could be that I'm unsure how to nest another variable
withn spd.f.  Perhaps if I give a better explanation of my goal things will
make more sense.

My intent is to calculate two sets of confidence intervals to show the
benefits of a DOE approach versus a Non-DOE approach.  For example, I want
to calculate the confidence intervals for "f" and "s" in two ways.  First
using a DOE approach, by taking the mean of the "f" or "s" values
plus/minus t-value at a 95%ci with 10df multiplied by the standard error
[mean(f-values) +- tval(.95ci,10df)*std.err].  Second using a "bin"
specific approach which only looks at the 6 "f" or "s" values (i.e,
mean(f-values) +- tval(.95ci, 5df)*std.err.mean).

This will leave me with two confidence intervals, that I want to plot side
by side to show that the DOE approach confidence interval will be smaller
for most cases.  I have attached a sample plot that shows the plot layout
I'm trying to get.

Thanks

AG



Hi:

Your code makes no sense because the variable by which you want to
dodge is the same as the one you're using on the x-axis. Dodging by
subgroups is an application of visualizing nested data, which you
don't have (at least in the state that you posted). For your data,
this would work:

ggplot(data, aes(x = spd, y = r, colour = spd)) +
   geom_errorbar(aes(ymin = 3, ymax = 5), width = 0.1) +
   geom_point()

I don't understand the point of the second geom_errorbar() call, so
I'm just avoiding it.

In order to dodge (appose groups in factor B side by side within each
level of factor A), you need a third variable whose values are nested
within levels of spd.f.

HTH,
Dennis

On Thu, Jul 26, 2012 at 6:03 AM, Adam Gabbert <adamjgabbert at gmail.com>
wrote: