# NOT RUN {
#================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
# }
# NOT RUN {
# dottest
# }
Run the code above in your browser using DataLab