[R] ggplot stat_summary(mean_cl_boot)

David Winsemius dwinsemius at comcast.net
Wed Nov 9 23:11:38 CET 2011

On Nov 9, 2011, at 4:30 PM, Ben Bolker wrote:

> 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

Another ggplot2 function with no help page, although it does bring up  
a help page with a link to smean.cl.boot

> 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.

Right. And the code for mean_cl_boot threatens to pass any extra  
parameters. But I'm still scratching my head about how smean.cl.boot  
get called because it is never mentioned by name and then there is an  
ignore.dots parameter that apparently renegs on the promise to pass  
the B argument.

>  ?smean.cl.boot (in Hmisc, so you'll need to have that package
> loaded) has a B=1000 parameter for bootstrapping.

As I almost always do.

>   I don't know if stat_summary(fun.data="mean_cl_boot",B=10000)

Might need to be:

stat_summary(fun.data="mean_cl_boot",B=10000, ignore.dots=FALSE)

> 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 ...)
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list