[R] ggplot stat_summary(mean_cl_boot)

Ben Bolker bbolker at gmail.com
Wed Nov 9 22:30:02 CET 2011

David Winsemius <dwinsemius <at> comcast.net> writes:

> On Nov 9, 2011, at 2:59 PM, Nathan Miller wrote:
> > Hello,
> >
> > This is a pretty simple question, but after spending quite a bit of  
> > time
> > looking at "Hmisc" and using Google, I can't find the answer.
> >
> > If I use stat_summary(fun.data="mean_cl_boot") in ggplot to generate  
> > 95%
> > confidence intervals, how many bootstrap iterations are preformed by
> > default? Can this be changed? I would at least like to be able to  
> > report
> > the number of boot strap interations used to generate the CIs.
> >
> > I haven't been able to find "mean_cl_boot" as a function itself or
> > something ressembling it in the Hmisc documentation, but it seems as  
> > though
> > Hmisc is wrapped up in stat_summary() and is called to compute
> > "mean_cl_boot".
> You seem really, really confused (and you offer very little in the way  
> of context to support debugging efforts). You are referring to ggplot  
> functions. As far as I know there is no connection between the Hmisc  
> and ggplot (or ggplot2) packages. Al things change, I know, but Frank  
> just completed switching over to Lattice a couple of years ago.

  In defense of the OP, this is a very confusing situation.
 mean_cl_boot is a ggplot2 function that wraps smean.cl.boot
from the Hmisc package: it's almost impossible to figure this
out from looking at the raw code of mean_cl_boot, although the
help page for ?mean_cl_boot does reference smean.cl.boot.
  ?smean.cl.boot (in Hmisc, so you'll need to have that package
loaded) has a B=1000 parameter for bootstrapping.
   I don't know if stat_summary(fun.data="mean_cl_boot",B=10000)
will work or not, but it would be worth a try (try setting B
to a small number and see if your CIs get very noisy, or set
it to a large number and see if your plot starts taking a lot
longer to compute ...)

More information about the R-help mailing list