Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotHaz

Graphical comparing of cumulative hazards


Description

Comparison of the cumulative hazards functions for a semi-parametric and parametric models.

Usage

plotHaz(
  sp,
  pp,
  interval,
  main = NULL,
  xlab = "Time",
  ylab = "Cum. hazards",
  leglab,
  col = c("blue", "red"),
  lty = 1:2,
  ylim,
  log = "",
  printLegend = TRUE
)

Arguments

sp

An object of type "coxreg" or "phreg", typically output from coxreg or phreg.

pp

An object of type "coxreg" or "phreg", typically output from coxreg or phreg.

interval

Time interval for the plot, if missing, calculated from sp.

main

Header for the plot. Default is distribution and "cumulative hazard function"

xlab

Label on x axis (default "Time")

ylab

Label on y axis (default "Cum. Hazards")

leglab

Labels in legend.

col

Line colors. should be NULL (black lines) or of length 2

lty

line types.

ylim

Y limits for the plot.

log

Argument sent to plot, defaults to "".

printLegend

Should a legend be printed? Default is TRUE.

Details

For the moment only a graphical comparison. The arguments sp and pp may be swapped.

Value

No return value.

Author(s)

Göran Broström

See Also

Examples

data(mort)
op <- par(mfrow = c(1, 2))
fit.cr <- coxreg(Surv(enter, exit, event) ~ ses, data = mort)
fit.w <- phreg(Surv(enter, exit, event) ~ ses, data = mort)
fit.g <- phreg(Surv(enter, exit, event) ~ ses, data = mort,
dist = "gompertz")
plotHaz(fit.cr, fit.w, interval = c(0, 20), main = "Weibull")
plotHaz(fit.cr, fit.g, main = "Gompertz")
par(op)

eha

Event History Analysis

v2.10.0
GPL (>= 2)
Authors
Göran Broström [aut, cre], Jianming Jin [ctb]
Initial release
2022-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.