Learn R Programming

riskRegression (version 2022.09.23)

plotEffects: Plotting time-varying effects from a risk regression model.

Description

Plot time-varying effects from a risk regression model.

Usage

plotEffects(
  x,
  formula,
  level,
  ref.line = TRUE,
  conf.int = 0.95,
  xlim,
  ylim,
  xlab = "Time",
  ylab = "Cumulative coefficient",
  col,
  lty,
  lwd,
  add = FALSE,
  legend,
  axes = TRUE,
  ...
)

Arguments

x

Fitted object obtained with one of ARR, LRR, riskRegression.

formula

A formula to specify the variable(s) whose regression coefficients should be plotted.

level

For categorical variables the level (group) whose contrast to the reference level (group) should be plotted.

ref.line

Logical. If TRUE then add a horizontal line at zero.

conf.int

Logical. If TRUE then add confidence limits. Can be controlled using smart arguments. See examples

xlim

See plot

ylim

See plot

xlab

See plot

ylab

See plot

col

A vector of colors for the regression coefficients.

lty

A vector of line types for the regression coefficients.

lwd

A vector of line thicknesses for the regression coefficients.

add

Logical. If TRUE then add lines to an existing plot.

legend

Logical. If TRUE then add a legend. Can be controlled using smart arguments. See examples.

axes

Logical. If FALSE then do not draw axes.

...

Used for transclusion of smart arguments for plot, axis. See function SmartControl from prodlim.

Author

Thomas H. Scheike ts@biostat.ku.dk

Thomas A. Gerds tag@biostat.ku.dk

Examples

Run this code

library(survival)
library(prodlim)
data(Melanoma)

fit.tarr <- ARR(Hist(time,status)~strata(sex),
                data=Melanoma,
                cause=1)
plotEffects(fit.tarr)

fit.tarr <- ARR(Hist(time,status)~strata(sex)+strata(invasion),
                data=Melanoma,
                cause=1,
                times=seq(800,3000,20))
plotEffects(fit.tarr,formula=~sex)
plotEffects(fit.tarr,formula=~invasion)
plotEffects(fit.tarr,
            formula=~invasion,
            level="invasionlevel.1")

## legend arguments are transcluded:
plotEffects(fit.tarr,
            formula=~invasion,
            legend.bty="b",
            legend.cex=1)

## and other smart arguments too:
plotEffects(fit.tarr,
	    formula=~invasion,
	    legend.bty="b",
axis2.las=2,
	    legend.cex=1)


Run the code above in your browser using DataLab