boxplot.Score: Boxplot risk quantiles

Description Usage Arguments Examples

View source: R/boxplot.Score.R

Description

Retrospective boxplots of risk quantiles conditional on outcome

Usage

1
2
3
4
5
## S3 method for class 'Score'
boxplot(x, model, reference, type, timepoint,
  overall = 1L, lwd = 3, xlim, xlab = "", main, outcome.label,
  outcome.label.offset = 0, event.labels, refline = (type == "diff"),
  add = FALSE, ...)

Arguments

x

Score object obtained by calling function Score.

model

Choice of risk prediction model

reference

Choice of reference risk prediction model for calculation of risk differences.

type

Either "risk" for predicted risks or "diff" for differences between predicted risks.

timepoint

time point specifying the prediction horizon

overall

Logical. Tag to be documented.

lwd

line width

xlim

x-axis limits

xlab

x-axis label

main

title of plot

outcome.label

Title label for column which shows the outcome status

outcome.label.offset

Vertical offset for outcome.label

event.labels

Labels for the different events (causes).

refline

Logical, for type="diff" only. If TRUE draw a red vertical line at 0.

add

Logical. Tag to be documented.

...

not used

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# binary outcome
db=sampleData(40,outcome="binary")
fitconv=glm(Y~X3+X5,data=db,family=binomial)
fitnew=glm(Y~X1+X3+X5+X6+X7,data=db,family=binomial)
scoreobj=Score(list(new=fitnew,conv=fitconv),
        formula=Y~1,contrasts=list(c(2,1)),
               data=db,summary="riskQuantile",null.model=FALSE)
boxplot(scoreobj)

# survival outcome
library(survival)
ds=sampleData(40,outcome="survival")
fitconv=coxph(Surv(time,event)~X6,data=ds,x=TRUE,y=TRUE)
fitnew=coxph(Surv(time,event)~X6+X9,data=ds,x=TRUE,y=TRUE)
## Not run:  
scoreobj=Score(list("conventional model"=fitconv,"new model"=fitnew),
                formula=Hist(time,event)~1, data=ds,
                summary="riskQuantile",metrics=NULL, plots=NULL,
                c(0,0.25,0.5,0.75,1),
                times=5,null.model=FALSE)
boxplot(scoreobj)

scoreobj1=Score(list("conventional model"=fitconv,"new model"=fitnew),
                formula=Hist(time,event)~1, data=ds,
                summary="riskQuantile",metrics=NULL, plots=NULL,
                times=5,null.model=FALSE,compare=list(c(2,1)))
boxplot(scoreobj1)

## End(Not run)

# competing risks outcome
library(survival)
data(Melanoma, package = "riskRegression")
fitconv = CSC(Hist(time,status)~invasion+age+sex,data=Melanoma)
fitnew = CSC(Hist(time,status)~invasion+age+sex+logthick,data=Melanoma)
scoreobj=Score(list("Conventional model"=fitconv,"New model"=fitnew),
               formula=Hist(time,status)~1,
               data=Melanoma,metrics=NULL,summary="riskQuantile",times=5*365.25,null.model=FALSE)
boxplot(scoreobj)

# more than 2 competing risks
m=lava::lvm(~X1+X2+X3)
lava::distribution(m, "eventtime1") <- lava::coxWeibull.lvm(scale = 1/100)
lava::distribution(m, "eventtime2") <- lava::coxWeibull.lvm(scale = 1/100)
lava::distribution(m, "eventtime3") <- lava::coxWeibull.lvm(scale = 1/100)
lava::distribution(m, "censtime") <- lava::coxWeibull.lvm(scale = 1/100)
lava::regression(m,eventtime2~X3)=1.3
m <- lava::eventTime(m,
time ~ min(eventtime1 = 1, eventtime2 = 2, eventtime3 = 3, censtime = 0), "event")
set.seed(101)
dcr=as.data.table(lava::sim(m,101))
fitOld = CSC(Hist(time,event)~X1+X2,data=dcr)
fitNew = CSC(Hist(time,event)~X1+X2+X3,data=dcr)
scoreobj=Score(list("Conventional model"=fitOld,"New model"=fitNew),
               formula=Hist(time,event)~1,
               data=dcr,summary="riskQuantile",times=5,null.model=FALSE)
boxplot(scoreobj)

riskRegression documentation built on Oct. 5, 2018, 1:03 a.m.