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

1

1

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)))

forstplot

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)?

enter image description here

Salmanazar answered 1/12, 2021 at 16:18 Comment(0)
S
2

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:

enter image description here

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

Salmanazar answered 21/7, 2022 at 14:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.