getTimeROC: time-dependent ROC curve base on timeROC package

Description Usage Arguments Value Author(s) See Also Examples

View source: R/clinic_getTimeROC.R

Description

getTimeROC is a powerful function to do time-dependent ROC curve base on timeROC::timeROC.getTimeROC help quickly and conveniently set common parameter in a ROC curve of ggplot2 style.

Usage

1
2
3
4
5
6
7
8
9
getTimeROC(data, time.col, status.col, cause, markers,
  merge.markers = NULL, weighting.univariate = c("marginal", "cox",
  "aalen")[2], weighting.multivariate = c("marginal", "cox", "aalen")[2],
  time.raw.type = c("Day", "Month", "Year")[1],
  time.target.type = c("Day", "Month", "Year")[3], time.knot = c(3, 5),
  line.color = mycolor, size = 1.2, half.border = F,
  legend.position = c(0.8, 0.2), show.auc = T, auc.digits = 2,
  reference = T, width = 10, height = 10, merge.plot = T,
  names = "love")

Arguments

data

a data frame

time.col

time colnames

status.col

status

cause

the event status.For example,if 1=death,0=alive,then cause should be 1.

markers

The vector of the marker values for which we want to compute the time-dependent ROC curves. Without loss of generality, the function assumes that larger values of the marker are associated with higher risks of events. If lower values of the marker are associated with higher risks of events, then reverse the association adding a minus to the marker values.

merge.markers

a list of markers groups.Default is NULL.

weighting.univariate

Default is "marginal"

weighting.multivariate

Default is "cox"

time.raw.type

one of "Day","Month","Year"

time.target.type

one of "Day","Month","Year"

time.knot

target time knots.Like 3 years and 5 years survival.

line.color

line colors in ROC plot.

size

the size of plot

half.border

whether show half border of the plot

legend.position

the position of legend position

width

the width of plot

height

the height of plot

merge.plot

whether use a merge style by time.knot

names

part of output file name.

Value

a list contain model information and series ggplot object.

Author(s)

Weibin Huang<654751191@qq.com>

See Also

timeROC.

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
library(lucky)
library(survival)
data(pbc)
pbc<-pbc[!is.na(pbc$trt),]
pbc$status<-as.numeric(pbc$status==2)
data = pbc
time.col = "time"
status.col ="status"
cause = 1
markers = c("bili","chol")
merge.markers=list(c("bili","chol"))
time.raw.type=c("Day","Month","Year")[1]
time.target.type=c("Day","Month","Year")[3]
time.knot=c(3,5)
names = "love"
line.color = mycolor[c(4,5,3,8,23)]
legend.position = "top"
weighting.univariate = "marginal"
weighting.multivariate = "cox"
size = 1.2
half.border=T
reference = F
width = 10
height=10
merge.plot = T
names = "love"

## merge style
models.merge <- getTimeROC(data,
                           time.col,status.col,cause,
                           markers,
                           merge.markers,
                           time.raw.type=time.raw.type,
                           time.target.type=time.target.type,
                           time.knot=time.knot,
                           line.color = line.color,
                           half.border=half.border,
                           reference = reference,
                           names = "love")

## single style
models.single <- getTimeROC(data,
                            time.col,status.col,cause,
                            markers,
                            merge.markers,
                            time.raw.type=time.raw.type,
                            time.target.type=time.target.type,
                            time.knot=time.knot,
                            line.color = line.color,
                            half.border=half.border,
                            reference = reference,
                            merge.plot = F,
                            names = "love")

## Paquid
library(timeROC);library(survival)
data(Paquid) # rm(Paquid)
Paquid$DSST <- -Paquid$DSST
Paquid$status <- ifelse(Paquid$status == 1,1,0)
models.merge <- getTimeROC(data = Paquid,
                           time.col = "time",
                           status.col = "status",
                           cause = 1,
                           markers = "DSST",
                           merge.markers = list(
                             merge = c("DSST","MMSE")
                           ),
                           time.raw.type="Year",
                           time.target.type="Year",
                           time.knot= c(3,5),
                           line.color = mycolor[c(1,3,4)],
                           names = "Paquid1")

shijianasdf/BasicBioinformaticsAnalysisFromZhongShan documentation built on Jan. 3, 2020, 10:08 p.m.