NikNakk / forestmodel

42 stars 13 forks source link

Forestmodel no longer showing interaction terms in multivariable model #35

Open radiaj opened 3 years ago

radiaj commented 3 years ago

Hello, I have generated some figures in the past that showed the interaction terms in the figure and now they have been removed with only main terms being showing in the plot. How do I switch it back to generate these plots.

library(forestmodel)
library(survival)
library(dplyr)
pretty_lung <- lung %>%
    dplyr::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) ~ ECOG * Age, pretty_lung)))

coxph(Surv(time, status) ~ ECOG * Age, pretty_lung
+ )
Call:
coxph(formula = Surv(time, status) ~ ECOG * Age, data = pretty_lung)

               coef exp(coef)  se(coef)      z       p
ECOG1       3.94301  51.57385   1.62842  2.421 0.01546
ECOG2       5.29316 198.97030   1.89672  2.791 0.00526
ECOG3       1.76105   5.81852   1.03344  1.704 0.08837
Age         0.05991   1.06174   0.02222  2.696 0.00702
ECOG1:Age  -0.05718   0.94442   0.02540 -2.251 0.02439
ECOG2:Age  -0.06954   0.93283   0.02907 -2.392 0.01677
ECOG3:Age        NA        NA   0.00000     NA      NA

Likelihood ratio test=26.49  on 6 df, p=0.0001804
n= 227, number of events= 164 
   (1 observation deleted due to missingness)

But the output figure only shows

ECOG1 3.94301 51.57385 1.62842 2.421 0.01546 ECOG2 5.29316 198.97030 1.89672 2.791 0.00526 ECOG3 1.76105 5.81852 1.03344 1.704 0.08837 Age 0.05991 1.06174 0.02222 2.696 0.00702

Rplot

ypnngaa-py commented 2 years ago

I have the same question. Wondering if interaction term is supported