0

I have calculated a list of 95% confidence intervals (ci) for 12 bars (means) using facet_grid plots in ggplot2:

ci <- c(0.17360519, 0.08659052, 0.19434605, 0.20922361, 0.06032738, 0.17054205,
        0.28033997, 0.18371310, 0.11388905, 0.24240948, 0.04037120, 0.19849716)

I can plot these confidence intervals using this code:

geom_errorbar(aes(ymin=Prob-ci, ymax=Prob+ci),
            width=.1, # Width of the error bars
            position=position_dodge(.09))

where 'Prob' is the mean on the y-axis.

My question is: How do I plot these confidence intervals after I've bootstrapped them using library(boot)?

For example, after bootstrapping as follows:

mean.boot <- function(x,ind)
{
return(c(mean(x[ind]),var(x[ind])/length(ind)))
}
out <- boot(ci,mean.boot,100000)

when this is the output:

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 100000 bootstrap replicates

CALL : 
boot.ci(boot.out = out)

Intervals : 
Level      Normal              Basic             Studentized     
95%   ( 0.1232,  0.2025 )   ( 0.1239,  0.2032 )   ( 0.1099,  0.2062 )  

Level     Percentile            BCa          
95%   ( 0.1224,  0.2017 )   ( 0.1208,  0.2003 )  
Calculations and Intervals on Original Scale

Thanks for your time as always.

Siguza
  • 21,155
  • 6
  • 52
  • 89
Docconcoct
  • 2,040
  • 4
  • 28
  • 52
  • 1
    Are you asking how to extract the bootstrap estimates? To get bootstrapped CIs I think you would pass the data to your bootstrap, not your previously calculated CIs. – Rorschach Aug 05 '15 at 18:11
  • I do not understand what you mean by "how to bootstrap confidence intervals". You use the bootstrap method to calculate CIs. – Roland Aug 05 '15 at 18:34
  • I'm apparently using boot incorrectly. I basically want to calculate CIs using the bootstrap method as @Roland articulated coherently. I'm guessing nongkrong has the right idea. I'll just have to figure out how to do that. – Docconcoct Aug 05 '15 at 18:42
  • Study the examples in `help("stat_summary")`. – Roland Aug 05 '15 at 18:45

0 Answers0