我想在非整体森林图中将预测区间覆盖在置信区间上,以比较这些区间之间的宽度。 所需森林图的示例如下:

在此处输入图片说明

但是,我似乎无法使用 'forestplot' 包找到正确的函数。 有没有人知道如何在 R 中创建分析?

更新:为了说明,我制作了一个虚拟数据集如下:

names <- c("Variable", "Diabetes", "Hypertension", "Cancer", "Asthma")
n <- c("N", 5, 5, 5, 5)
coef <- c(1.10, 1.05, 1.20, 1.25)
ci.low <- c(1.05, 1.02, 1.18, 1.21)
ci.high <- c(1.12, 1.07, 1.24, 1.29)
pi.low <- c(0.80, 0.99, 0.97, 0.95)
pi.high <- c(1.45, 1.30, 1.44, 1.66)
boxsize <- c(0.2,0.2,0.2,0.2)
test_data <- data.frame(coef=coef, low=ci.low,high=ci.high, boxsize=boxsize)
test_data <- rbind(NA,  test_data)
row_names <- cbind(names, n, c("OR [95% CI]", "1.10 [1.05-1.12]", "1.05 [1.02-1.07]", "1.20 [1.18-1.24]", "1.25 [1.21-1.29]"))

#Forest plot
forestplot(labeltext = row_names,
           mean = test_data$coef, upper = test_data$high,
           lower = test_data$low,
           is.summary=c(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE),
           boxsize = test_data$boxsize,
           zero = 1,
           xlog = FALSE,
           xlab = "OR (95% CI)",
           clip = c(0,2),
           col = fpColors(lines="black", box="black"),
           colgap = unit(0.03,'npc'),
           hrzl_lines= TRUE,
           lineheight = unit(1.1,"cm"),
           graphwidth = "auto",
           txt_gp=fpTxtGp(label = gpar(cex = 0.8),
                          title = gpar(cex = 1),
                          ticks = gpar(cex = 0.7),
                          xlab = gpar(cex = 0.7)))

返回这个数字: 在此处输入图片说明

但是,我似乎仍然找不到合适的函数来覆盖置信区间上的预测区间。 非常感谢您提前。

  ask by Gilbert translate from so

本文未有回复,本站智能推荐:

2回复

Metafor森林图显示了不正确的比值置信区间

I'm trying to plot odds ratios and corresponding 90% confidence intervals, which I have previously obtained from a proportional odds model using packa
2回复

如何使用R中的“bootstrap函数”计算置信区间

I am trying to calculate the confidence interval in R. Due to some special reasons, I have to do it with the functions in "bootstrap" package.(which m
1回复

ggplot2图中的置信区间与使用R中的预测函数获得的值不同

This is my data (EXAMPLE): 这是我的数据(示例): EXAMPLE<-data.frame( X=c(99.6, 98.02, 96.43, 94.44, 92.06, 90.08, 87.3, 84.92, 82.14, 79.76, 76.98, 74.2
1回复

绘制R中的预测概率和置信区间

This is a plot I did, I want the confidence intervals for the plot, both upper and lower. 这是我做的图,我想要该图的置信区间(上下限)。 I have come so far that I have prod
3回复

如何使用glmmTMB的预测函数拟合置信区间

I am running a mixed model using the package glmmTMB and using the predict function to calculate predicted means using the following code:我正在使用包 glmmT
2回复

R中的置信区间计算

I'm finding differences when trying to calculate the CI in R :我在尝试计算R中的CI时发现差异:x=c(25,30,15,45,22,54)#IC 1install.packages("Rmisc")library(Rmisc)CI(x,