0

Using the eha package, it is possible to plot coxreg() objects. One of the parameters of plot.coxreg is fn = c("cum", "surv", "log", "loglog"). The argument "cum" gives the plot for the cumulative hazard function as shown here, using the following code:

library(eha)

# Fit the cox regression with sex as predictor
model <- coxreg(Surv(enter, exit, event) ~ strata(male), data = df)

# Create cumulative hazard plot
plot(model, fn = "cum", ylab = "Cumulative hazard")

I want to be able to produce a plot just for the hazard function, how do I do that?

I also want to know why I cannot get a regression summary using summary() for the fitted model.

model <- coxreg(Surv(enter, exit, event) ~ strata(male), data = df)
summary(model) # Returns NULL Model

# But this works
model1 <- coxreg(Surv(enter, exit, event) ~ male, data = df) # Removed strata()
summary(model1)
Cloft X
  • 141
  • 7

0 Answers0