Learn R Programming

riskRegression (version 1.4.3)

plotRisk: plot predicted risks

Description

plot predicted risks

Usage

plotRisk(x, models, times, xlim = c(0, 1), ylim = c(0, 1), xlab, ylab, col,
  pch = 1, cex = 1, ...)

Arguments

x

Object obtained with function Score

models

Choice of two models to plot. The predicted risks of the first (second) are shown along the x-axis (y-axis).

times

Time point specifying the prediction horizon.

xlim

x-axis limits

ylim

y-axis limits

xlab

x-axis labels

ylab

y-axis labels

col

colour

pch

point type

cex

point size

...

Used to control the subroutines: plot, axis, lines, barplot, legend. See SmartControl.

Value

a nice graph

Details

Two rival prediction models are applied to the same data.

Examples

Run this code
# NOT RUN {
## uncensored
learndat = sampleData(40,outcome="binary")
testdat = sampleData(40,outcome="binary")
lr1 = glm(Y~X1+X2+X7+X9,data=learndat,family="binomial")
lr2 = glm(Y~X3+X5+X6,data=learndat,family="binomial")
xb=Score(list("LR(X1+X2+X7+X9)"=lr1,"LR(X3+X5+X6)"=lr2),formula=Y~1,
         data=testdat,summary="risks",nullModel=0L)
plotRisk(xb)
## survival
library(survival)
learndat = sampleData(40,outcome="survival")
testdat = sampleData(40,outcome="survival")
cox1 = coxph(Surv(time,event)~X1+X2+X7+X9,data=learndat,x=TRUE)
cox2 = coxph(Surv(time,event)~X3+X5+X6,data=learndat,x=TRUE)
xs=Score(list("Cox(X1+X2+X7+X9)"=cox1,"Cox(X3+X5+X6)"=cox2),formula=Surv(time,event)~1,
         data=testdat,summary="risks",nullModel=0L)
plotRisk(xs,times=5)

# }

Run the code above in your browser using DataLab