DrawCurves: Draw FROC curves

Description Usage Arguments Details Examples

View source: R/DrawCurves.R

Description

plots FROC curves, AFROC curves and FPF and TPF.

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
DrawCurves(
  StanS4class,
  modalityID,
  readerID,
  title = TRUE,
  type_to_be_passed_into_plot = "l",
  indexCFPCTP = FALSE,
  upper_x,
  upper_y,
  lower_X = 0,
  lower_y = 0,
  new.imaging.device = TRUE,
  Colour = TRUE,
  DrawFROCcurve = TRUE,
  DrawAFROCcurve = FALSE,
  DrawAUC = TRUE,
  DrawCFPCTP = TRUE,
  Draw.Flexible.upper_y = TRUE,
  Draw.Flexible.lower_y = TRUE,
  summary = TRUE,
  type = 4,
  color_is_changed_by_each_reader = FALSE,
  Draw.inner.circle.for.CFPCTPs = TRUE
)

Arguments

StanS4class

An S4 object of class stanfitExtended which is an inherited class from the S4 class stanfit. This R object is a fitted model object as a return value of the function fit_Bayesian_FROC().

To be passed to DrawCurves() ... etc

modalityID

A positive integer vector indicating modalityID. If it is not given, then the first modality is chosen.

readerID

A positive integer vector indicating readerID. If it is not given, then the first reader is chosen.

title

Logical: TRUE of FALSE. If TRUE (default), then title of curves are drawn.

type_to_be_passed_into_plot

"l" or "p".

indexCFPCTP

TRUE of FALSE. If TRUE, then the cumulative false and hits are specified with its confidence level.

upper_x

A non-negative real number. This is a upper bound for the axis of the horisontal coordinate of FROC curve.

upper_y

A non-negative real number. This is a upper bound for the axis of the vertical coordinate of FROC curve.

lower_X

A non-negative real number. This is a lower bound for the axis of the horisontal coordinate of FROC curve.

lower_y

A non-negative real number. This is a lower bound for the axis of the vertical coordinate of FROC curve.

new.imaging.device

Logical: TRUE of FALSE. If TRUE (default), then open a new device to draw curve. Using this we can draw curves in same plain by new.imaging.device=FALSE.

Colour

Logical: TRUE of FALSE. whether Colour of curves is dark theme or not.

DrawFROCcurve

Logical: TRUE of FALSE. Whether or not FROC curves are shown.

DrawAFROCcurve

Logical: TRUE of FALSE. Whether or not AFROC curves are shown.

DrawAUC

TRUE of FALSE. If TRUE then area under the AFROC curves are painted.

DrawCFPCTP

Logical: TRUE of FALSE. Whether or not the pairs of FPF and TPF are shown.

Draw.Flexible.upper_y

Logical: TRUE of FALSE. Whether or not the upper bounds of vertical axis are determined automatically.

Draw.Flexible.lower_y

Logical: TRUE of FALSE. Whether or not the lower bounds of vertical axis are determined automatically.

summary

Logical: TRUE of FALSE. Whether to print the verbose summary. If TRUE then verbose summary is printed in the R console. If FALSE, the output is minimal. I regret, this variable name should be verbose.

type

An integer, for the color of background and etc.

color_is_changed_by_each_reader

A logical, if TRUE, then the FROC curves, AFROC curves, and FPF, TPF are colored accordingly by each reader. The aim of FROC analysis is to compare the modality and not reader, so the default value is false, and curves and FPF and TPF are colored by each modalities.

Draw.inner.circle.for.CFPCTPs

TRUE or FALSE. If true, then to plot the cumulative false positives and true positives the plot points is depicted by two way, one is a large circle and one is a small circle. By see the small circle, user can see the more precise position of these points.

Details

plots of the FROC curves and AFROC curves for user's specified modality and user's specified reader. Using this function repeatedly, we can draw the different reader and modality in a same plane simultaneously. So, we can visualize the difference of modality ( or reader).

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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#================The first example=======================================================
## Not run: 
# 1) Fit a model to data by the following:



  fit <- fit_Bayesian_FROC(
  BayesianFROC::dataList.Chakra.Web,    # data to which fit the model
                           ite=1111  # iteration of MCMC is too small
                           )

# Note that the return value "fit" is an object of an inherited S4 class from stanfit




# 2)
#  With the above S4 class object, we plot the curves.



          DrawCurves(
                    fit,
                    modality = 1,
                      reader = 4)

# From this code, an FROC curve is plotted
# for the first modality and the fourth reader.







#3)
   # By changing, e.g., the modality, in the above,
   # we can draw the curves for different  modalities.
   # This shows the comparison of modalites.
   # In the following,
   # the first script plots a curve for the 2 nd modality and the fourth reader,
   # and the second script plots a curve for the 3rd modality and the 4 th reader,
   # respectively.



            DrawCurves(fit,modality = 2,reader = 4)
            DrawCurves(fit,modality = 3,reader = 4)



# Curves are overwritten in a single imaging device for the comparison.



#4) By applying the function with respect to different modalities
#   in this manner, we can draw  AFROC (FROC) curves in the same plain.



#5) If you want to draw the FROC curves
#for reader ID =1,2,3,4 and modality ID =1,2, then the code is as follows;

                  DrawCurves(
                            fit,
                            modalityID = c(1,2,3,4),
                            readerID   = c(1,2)
                            )
# Each color of curves corresponds to the modality ID.
# So, the curves of "different" readers will have the "same" color,
# if their modalities are "same".







# 6) To show only data points, i.e. FPF and TPF,
#    use DrawFROCcurve = F as follows;

DrawCurves(fit,
           DrawCFPCTP    = TRUE,   # This implies data points are ploted.
           DrawFROCcurve = FALSE,  # From this, the curves are not drawn.
           modalityID    = c(1,2,3,4),
           readerID      = c(1)
           )







#7) If you use the plot in submission and it is not allowed to use color, then
#   by Colour  = FALSE, you can get black and white plots, e.g.,


DrawCurves(fit,
          DrawCFPCTP    = TRUE,
          DrawFROCcurve = TRUE,
          modalityID    = c(1,2,3,4),
          readerID      = c(1),
          Colour = FALSE    # From this, you can get plots without colors.
          )







#8)  For AFROC, use DrawAFROCcurve = T

DrawCurves(fit,
          DrawFROCcurve  = FALSE,
          DrawAFROCcurve = TRUE,
          modalityID     = c(1,2,3,4),
          readerID       = c(1)
          )






#9)

# In order to compare modality, we draw curves by each modality
# The 1-st modality with all readers 1,2,3,4:


DrawCurves(fit,modalityID = 1,readerID = 1:4, new.imaging.device = TRUE)

#The 2-nd modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 2,readerID = 1:4, new.imaging.device = FALSE)


#The 3-rd modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 3,readerID = 1:4, new.imaging.device = FALSE)


#The 4-th modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 4,readerID = 1:4, new.imaging.device = FALSE)


#The 5-th modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 5,readerID = 1:4, new.imaging.device = FALSE)



# Draw for all pairs of modalities and readers:

            DrawCurves(
                        modalityID = 1:fit@dataList$M,
                          readerID = 1:fit@dataList$Q,
                       StanS4class = fit
                        )









# Changes the color by


                             DrawCurves(fit, type = 2)
                             DrawCurves(fit, type = 3)
                             DrawCurves(fit, type = 4)
                             DrawCurves(fit, type = 5)
                             DrawCurves(fit, type = 6)
                             DrawCurves(fit, type = 7)





#================The Second Example======================================================

# This function is available in the case of a single reader and a single modality.
# The reason why the maintainer separate the function for two processes, one is
# the fitting and the second is to plot curves is, in MRMC case,
# it tooks a time to drawing, but in the a single reader and a single modality case, drawing
# the curve is very fast, so in fitting process the curves are also depicted, however
# by this function user can draw the FROC curves.





#First, we prepare the data endowed with this package.





                          dat  <- get(data("dataList.Chakra.1"))




#Second, we fit a model to data named "dat"





                             fit <-  fit_srsc(dat)





# Drawing the curves by


                             DrawCurves(fit)






# Changes the color by


                             DrawCurves(fit, type = 2)
                             DrawCurves(fit, type = 3)
                             DrawCurves(fit, type = 4)
                             DrawCurves(fit, type = 5)
                             DrawCurves(fit, type = 6)
                             DrawCurves(fit, type = 7)

#      Close the graphic device to avoid errors in R CMD check.

     Close_all_graphic_devices() # 2020 August

## End(Not run)# dottest

BayesianFROC documentation built on Jan. 23, 2022, 9:06 a.m.