简体   繁体   中英

Improve Forest plot for subgroup analysis (not for meta-analysis)?

Currently my forest plots for subgroup analysis (not for meta-analysis) in R are like the following...

library("dplyr")
library(ggplot2)
library(survminer)
library(survival)
library(forestmodel)

pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` = meal.cal)

print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))

森林图

However, the sizes/heights of the squares are not proportional to the subgroup sample size. In other words, I would expect that the smaller the confidence interval, the larger the boxes/squares would be. Is there a way to fix that (as in this example: https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(05)61026-4/fulltext )?

在此处输入图像描述

So, after some time I've found a decent solution (using another package):


devtools::install_github("ewenharrison/finalfit")
library(finalfit)
library(dplyr) 
library(ggplot2)
library(survminer)
library(survival)

pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` = meal.cal)

explanatory = c("Age", "Sex", "ECOG", "`Meal Cal`")
dependent = "Surv(time, status)"
pretty_lung %>%
  hr_plot(dependent, explanatory, dependent_label = "Survival")

The output:

在此处输入图像描述

It may not be perfect, but it is another option and this package does the job with the sizes/heights of the squares

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM