Learn R Programming

riskRegression (version 0.0.8)

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, refLine = TRUE, confint = 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.
refLine
Logical. If TRUE then add a horizontal line at zero.
confint
Logical. If TRUE then add confidence limits.
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.

Examples

Run this code
library(pec)
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="invasion:level.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