我有3个估算载体:
est1 <- c(0.0930, NA, NA, 0.0157, 0.0187, 0.0137, NA, NA, 0.0426, NA, NA, NA, 0.0129, 0.0075, 0.0131, 0.0194, 0.0129, 0.0435, 0.0338, 0.0276, 0.0382, -0.0070)
est2 <- c(0.0094, NA, NA, 0.0081, 0.0060, 0.0066, NA, NA, 0.0060, NA, NA, NA, 0.0067, 0.0061, 0.0043, 0.0067, 0.0060, 0.0092, 0.0101, 0.0118, 0.0133, -0.0011)
est3 <- c(0.0045, 0.0064, 0.0053, 0.0060, 0.0057, 0.0061, 0.0081, 0.0044, 0.0074, 0.0077, 0.0059, 0.0086, 0.0059, 0.0040, 0.0068, 0.0059, 0.0056, NA, NA, 0.0130, 0.0130, 0.0071)
对于每个值,我有较低和较高的置信区间值。因此,对于est1 [1],我有置信区间2.5%= ci.low1 [1],97.5%= ci.upp1 [1]:
ci.low1 <- c(0.0906, NA, NA, 0.0137, 0.0176, 0.0119, NA, NA, 0.0421, NA, NA, NA, 0.0099, 0.0060, 0.0100, 0.0180, 0.0117, 0.0413, 0.0322, 0.0253, 0.0352, -0.0093)
ci.upp1 <- c(0.0963, NA, NA, 0.0183, 0.0228, 0.0154, NA, NA, 0.0434, NA, NA, NA, 0.0148, 0.0101, 0.0160, 0.0222, 0.0139, 0.0481, 0.0349, 0.0318, 0.0413, -0.0050)
ci.low2 <- c(0.0075, NA, NA, 0.0052, 0.0051, 0.0056, NA, NA, 0.0042, NA, NA, NA, 0.0050, 0.0042, 0.0019, 0.0049, 0.0047, 0.0083, 0.0093, 0.0101, 0.0126, -0.0025)
ci.upp2 <- c(0.0117, NA, NA, 0.0099, 0.0076, 0.0088, NA, NA, 0.0077, NA, NA, NA, 0.0078, 0.0078, 0.0051, 0.0084, 0.0072, 0.0102, 0.0107, 0.0131, 0.0153, 0.0011)
ci.low3 <- c(0.0001, 0.0046, 0.0028, 0.0042, 0.0006, 0.0040, 0.0021, 0.0028, 0.0038, 0.0069, 0.0052, 0.0055, 0.0040, -0.0008, 0.0048, 0.0035, 0.0040, NA, NA, 0.0114, 0.0094, 0.0029)
ci.upp3 <- c(0.0066, 0.0108, 0.0092, 0.0084, 0.0087, 0.0077, 0.0102, 0.0066, 0.0112, 0.0115, 0.0095, 0.0141, 0.0107, 0.0068, 0.0079, 0.0086, 0.0079, NA, NA, 0.0155, 0.0157, 0.0087)
我想制作一个我估计的条形图。像这样:
barplot(rbind(est1, est2, est3), beside = TRUE, col = c("blue", "red", "grey20"), ylim = c(-0.02,0.1), cex.names = 1.2, xpd = FALSE)
使用散点图,我通常使用函数箭头()添加置信区间,设置x0 = x1:
arrows(x0, y0, x1, y1, angle = 90, code = 3, lwd = 3, length = 0.1, col = 7)
但我不知道如何将其应用于这种条形结构。我需要获得x轴位置,并考虑该组条之间的间距。 任何人都可以提供一些帮助吗? 谢谢!