I have a dataset for which I want to calculate the geometric mean and the bootstrapped confidence interval. The data has "status" and and "index" ranging from 0 to 1.
I want to know:
(a) Is there an option where the fun.y = mean
can be replaced by a specific geometric mean function in ggplot2?
(b)How to plot appropriate confidence intervals given this mean using ggplot?
Here is the code that I have attempted to calculate.
status <- c("low","low","low","low","high","high","high","high")
index <- c(0.6,0.1,0.6,0.1,0.35,0.35,0.35, 0.35)
df <- data.frame(status, index)
pd <- position_dodge(0.82)
ggplot(df, aes(x=status, y=index, color = status)) + ylim(0,1) + theme_bw() + geom_point(position = pd, size = 1.5)+ stat_summary(aes(color = status),geom="errorbar", fun.data=mean_cl_boot, width = 0.2, size = 0.8, position = pd)+
stat_summary(aes(group = status),fun.y=mean, position = pd, geom = "point", size = 4 )