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

plot.phreg

Plots output from a phreg regression


Description

Plot(s) of the hazard, density, cumulative hazards, and/or the survivor function(s) for each stratum.

Usage

## S3 method for class 'phreg'
plot(
  x,
  fn = c("haz", "cum", "den", "sur"),
  main = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = "Duration",
  ylab = "",
  col,
  lty,
  printLegend = TRUE,
  score = 1,
  fig = TRUE,
  ...
)

Arguments

x

A phreg object

fn

Which function should be plotted? Default is the hazard function(s).

main

Header for the plot

xlim

x limits

ylim

y limits

xlab

x label

ylab

y label

col

Color(s) for the curves. Defaults to black.

lty

Line type for the curve(s). Defaults to 1:(No. of strata).

printLegend

Logical, or character ("topleft", "bottomleft", "topright" or "bottomright"); if TRUE or character, a legend is added to the plot if the number of strata is two or more.

score

Multiplication factor for the hazard function.

fig

logical, should the graph be drawn? If FALSE, data is returned.

...

Extra parameters passed to 'plot' and 'lines'.

Value

No return value if fig = TRUE, otherwise the cumulative hazards function (coordinates), given fn = "cum".

Note

Reference hazard is given by the fit; zero for all covariates, and the reference category for factors.

Author(s)

Göran Broström

See Also

Examples

y <- rllogis(40, shape = 1, scale = 1)
x <- rep(c(1,1,2,2), 10)
fit <- phreg(Surv(y, rep(1, 40)) ~ x, dist = "loglogistic")
plot(fit)

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.