ggplot: Plot for ROC curve

Description Usage Arguments Value Examples

Description

Plot for ROC curve

Usage

 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
## S3 method for class 'auc_coxph'
ggplot(
  data,
  mapping,
  color = NULL,
  lwd = 1.05,
  grid.space = 2,
  ncol = NULL,
  ...,
  environment = parent.frame()
)

## S3 method for class 'roc_coxph'
ggplot(
  data,
  mapping,
  color = NULL,
  lwd = 1.05,
  grid.space = 2,
  rank = FALSE,
  ncol = NULL,
  ...,
  environment = parent.frame()
)

## S3 method for class 'roc_logit'
ggplot(
  data,
  mapping,
  color = NULL,
  lwd = 1.05,
  grid.space = 2,
  rank = FALSE,
  ...,
  environment = parent.frame()
)

Arguments

data

resultes of roc() function

mapping

ignore

color

one or more colors

lwd

logical or integers

grid.space

space between grids, default is 2

ncol

number of column for grid plot

...

ignore

environment

ignore

rank

rank by AUC

Value

a ggplot picture.

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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
library(ggDCA)
library(rms)
library(modelROC)
###  COX ----------

fit <- cph(Surv(time,status)~ANLN+CENPA+GPR182,LIRI)

####        one model, one time ####
#----            auc for model

r <- auc(fit,
          model='This is model') # one model
unique(r)
ggplot(r)

r <- auc(fit,
          model=TRUE)            # all model
unique(r)
ggplot(r)


#----            auc for x
r <- auc(fit,
          x='ANLN')              # one x
unique(r)
ggplot(r)

r <- auc(fit,
          x=c('ANLN','CENPA'))   # more x
unique(r)
ggplot(r)

r <- auc(fit,
          x=TRUE)                # all x
unique(r)
ggplot(r)

r <- auc(fit,
          model=TRUE,            # one model
          x=TRUE)                # all x
unique(r)
ggplot(r)

r <- auc(fit,
          model='Three Genes',   # specify model names
          x=TRUE)                # all X
unique(r)
ggplot(r)



####        more models ####
fit2 <- cph(Surv(time,status)~ANLN+CENPA,LIRI)


r <- auc(fit,fit2,
          model=c('Three Genes','Two Genes'))            #
unique(r)
ggplot(r)



r <- auc(fit,fit2,
          model=TRUE,
          x=TRUE)
unique(r)
ggplot(r)

library(ggDCA)
library(rms)
fit <- lrm(status~ANLN+CENPA+GPR182,LIRI)
####        one model ####
pp <- roc(fit,
          model=TRUE) # one model
unique(pp)
ggplot(pp)

pp <- roc(fit,
          x='ANLN') # one x
unique(pp)
ggplot(pp)


pp <- roc(fit,
          x=c('ANLN','CENPA')) # more x
unique(pp)
ggplot(pp)


pp <- roc(fit,
          x=TRUE) # ALL x
unique(pp)
ggplot(pp)


pp <- roc(fit,
          model=TRUE, # one model
          x=TRUE) # ALL x
unique(pp)
ggplot(pp)

pp <- roc(fit,
          model='Three Genes', # specify model name
          x=TRUE) # ALL x
unique(pp)
ggplot(pp)

####        more model   ####

fit2 <- lrm(status~ANLN+CENPA,LIRI)
pp <- roc(fit,fit2,
          model=TRUE) # all model
unique(pp)
ggplot(pp)


pp <- roc(fit,fit2,
          model=c('Three Genes','Two Genes')) # specify model names
unique(pp)
ggplot(pp)

pp <- roc(fit,fit2,
          x=TRUE,                             # all x
          model=c('Three Genes','Two Genes')) # all model
unique(pp)
ggplot(pp)

###  COX ----------

fit <- cph(Surv(time,status)~ANLN+CENPA+GPR182,LIRI)
range(LIRI$time)
####        one model, one time ####
#----            roc for model

pp <- roc(fit, times=1,
          model='This is model') # one model
unique(pp)
ggplot(pp)

pp <- roc(fit, times=1,
          model=TRUE)            # all model
unique(pp)
ggplot(pp)

#----            roc for x
pp <- roc(fit, times=1,
          x='ANLN')              # one x
unique(pp)
ggplot(pp)

pp <- roc(fit, times=1,
          x=c('ANLN','CENPA'))   # more x
unique(pp)
ggplot(pp)

pp <- roc(fit, times=1,
          x=TRUE)                # all x
unique(pp)
ggplot(pp)

pp <- roc(fit, times=1,
          model=TRUE,            # one model
          x=TRUE)                # all x
unique(pp)
ggplot(pp)

pp <- roc(fit, times=1,
          model='Three Genes',   # specify model names
          x=TRUE)                # all X
unique(pp)
ggplot(pp)

####        one model, more time ####

pp <- roc(fit, times=c(1,2,3,4,5,6),
          model=TRUE)            # one model
unique(pp)
ggplot(pp)


pp <- roc(fit, times=c(1,2),
          x =  'ANLN')           # one x

unique(pp)
ggplot(pp)


pp <- roc(fit, times=c(1,2,3,4,5,6),
          x = c('ANLN','CENPA')) # more x
unique(pp)
ggplot(pp,ncol = 3)


pp <- roc(fit, times=c(1,2),
          model=TRUE,            # one model
          x = TRUE) # all x
unique(pp)
ggplot(pp)

####        more models, one time ####
fit2 <- cph(Surv(time,status)~ANLN+CENPA,LIRI)

pp <- roc(fit,fit2,times=1,
          x=TRUE,
          model=c('Three Genes','Two Genes'))            #
unique(pp)
ggplot(pp)
####        more models, more time ####
pp <- roc(fit,fit2,times=c(1,2),
          model=c('Three Genes','Two Genes'))            #
unique(pp)
ggplot(pp)

pp <- roc(fit,fit2,times=c(1,2),
          x=TRUE,
          model=c('Three Genes','Two Genes'))            #
unique(pp)
ggplot(pp)

modelROC documentation built on June 25, 2021, 5:09 p.m.

Related to ggplot in modelROC...