Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a set of f4 ratio statistics with standard errors for different populations/regional groups.

I want to make a plot where the X axis is the different groups and on the X axis I have the point estimates with error bars for 95% CIs. Basically, I want to graphically display how the values for my populations of interest fall out relative to each other and other groups.

My data basically looks like this:

Group   alpha   SE  Z   Sample size
Pop1    0.029000    0.003589    8.116   9
Pop2    0.031868    0.003498    8.231   9
Pop3    0.028969    0.003765    7.942   8
Pop4    0.030651    0.003479    8.792   10

alpha would be the point estimate and SE would be the standard error. (Z and sample size are irrelevant here).

Can anyone suggest a good way of doing this? Thanks!

(What I am looking for is something like Figure 2b here http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3493647/figure/f2/ except with error bars.)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
164 views
Welcome To Ask or Share your Answers For Others

1 Answer

Is this helpful in any way?

# > dput(df)
df <- structure(list(Group = structure(1:4, .Label = c("Pop1", "Pop2", 
"Pop3", "Pop4"), class = "factor"), alpha = c(0.029, 0.031868, 
0.028969, 0.030651), SE = c(0.003589, 0.003498, 0.003765, 0.003479
), Z = c(8.116, 8.231, 7.942, 8.792), Sample.size = c(9L, 9L, 
8L, 10L)), .Names = c("Group", "alpha", "SE", "Z", "Sample.size"
), class = "data.frame", row.names = c(NA, -4L))
# > df
#   Group    alpha       SE     Z Sample.size
# 1  Pop1 0.029000 0.003589 8.116           9
# 2  Pop2 0.031868 0.003498 8.231           9
# 3  Pop3 0.028969 0.003765 7.942           8
# 4  Pop4 0.030651 0.003479 8.792          10

# install.packages("ggplot2", dependencies = TRUE)
require(ggplot2)

ggplot(df, aes(y = Group, x = alpha, xmin = alpha - SE,  
               xmax = alpha + SE, label = Group, 
               colour = as.factor(Sample.size))) + 
      geom_point(colour = "black") + geom_text(hjust = 1.2) + theme_classic() +
      theme(axis.title = element_blank(), axis.ticks = element_blank(), 
      axis.text.y = element_blank(), legend.position = "none") # +
      geom_errorbarh(height = .1)

sigh


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...