strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
603 stars 91 forks source link

tab_model: p-values do not match the confidence interval of survival analysis #861

Open YUANDALAO opened 1 year ago

YUANDALAO commented 1 year ago

Hi,

Thank you for the package!

The thing is the p-values shown in tab_model or plot_models, do not match with the confidence interval of my survival analysis, and its model summary statistics.

Do you have any thoughts on how I can get/substract the p-values from summary statistics or how to change function?

Thank you!!

strengejacke commented 1 year ago

Do you have a reproducible example? Can you check what parameters::model_parameters() returns for your model?

PStaus commented 1 year ago

Hi. I really use your package often. It's great!

But I also recognized that robust standard errors / Confidence intervals are not plotted correctly for cox models. Even when specified with the vcov.fun option. The parameters::model_parameters() function also does not extract the robust standard errors, but the normal ones. This might also be the case for @YUANDALAO?

library("pacman")
p_load(sjPlot, survival, coxphw, ggplot2)

data("gastric", package = "coxphw")
head(gastric)

gastric1 <- cbind.data.frame(gastric, weights = c(rep(0.5, 45), rep(1,45)))
head(gastric1)

model<- coxph(Surv(time, status == 1) ~ radiation, data = gastric1, weights = weights)

CI <- summary(model)$conf.int[4]

plot_model(model)+
  geom_abline(intercept = CI , slope = 0)+
  lims(y = c(0.5, 1.8))

plot_model(model, vcov.fun = "vcov")+
  geom_abline(intercept = CI , slope = 0)+
  lims(y = c(0.5, 1.8))

It is also a little confusing that the y axis is the x axis to adjust for the limits.

Thank you a lot in advance Best wishes, Paulina