Error Bar Plot for R2 Confidence Intervals

I bootstrapped 1000 R2 replications for two different regression models, and used them to generate confidence intervals for each model's respective R2 value.

I'm trying to figure out how to generate an error bar plot that will show me both models R2 values and the 95% CI around each of them using my bootstrapped replications.

Any help would be great.

Are you looking for something like this?

library(ggplot2)
#simulate 1000 R2 values for each model
DF <- data.frame(Model = rep(c("Model1", "Model2"), each = 1000), 
                 R2 = c(rbeta(1000,shape1 = 60,shape2 = 10 ),
                        rbeta(1000,shape1 = 50,shape2 = 15 )))

#Make a data frame with the mean R2 and invent confidence intervals
Stats <- data.frame(Model = c("Model1", "Model2"), Avg = c(0.857, 0.768),
                    UCL = c(0.93, 0.87), LCL = c(0.76, 0.65))

ggplot() + geom_violin(mapping = aes(x = Model, y = R2), data = DF) +
  geom_point(mapping = aes(Model, Avg), data = Stats) + 
  geom_linerange(mapping = aes(x = Model, ymin = LCL, ymax = UCL), data = Stats)

Created on 2019-09-14 by the reprex package (v0.2.1)

Thanks for your reply I think its very close to the solution. The thing is I already have my all my data ready in two separate data.frames ( t : replications, t0 : R2), I also already know the confidence interval values. see below:
Model 1 CI [0.011,0.145]
Model 2 CI [0.015, 0.254]

I just need to know how to pass the data I already have into ggplot command.

FJCC has given you an example using made up sample data, since you haven't provided any, so you just have to replace the name of the sample dataframe i.e. DF in the code by your actual dataframe and modify the code a little bit to use your actual variable names.
If you want more specific help please provide a minimal REPRoducible EXample (reprex) illustrating your issue.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.