# NOT RUN {
#================The first example======================================
# }
# NOT RUN {
#1) Build the S4 class object by the following:
fit <- fit_Bayesian_FROC(
BayesianFROC::dataList.Chakra.Web, # data to which fit the model
ite=1111 # iteration of MCMC, very few, should be more.
)
# The object "fit" is an S4 class object
# whose S4 class is an inherited class from stanfit in the rstan package.
#<<Minor comments>>
#Note that return value "fit" is not an stanfit S4 object generated by rstan::stan(),
#but some inherited S4 class object which is an S4 object of
# some inherited S4 class from the stanfit class.
#2) Now, we obtain the S4 class object named "fit".
# Using this S4 class object, we draw the curves by:
DrawCurves(fit,modality = 1,reader = 4)
#From this code, FROC curve for the first modality and fourth reader is drawn.
#3) By changing, e.g., the modality,
#we can draw the curves for different modalities.
#This shows the comparison of modalites.
# In the following R script,
# the first draw curve for the 2 nd modality and the fourth reader,
# and the second R script draw 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 for the sake of comparison.
# When comparing modalities fitted by the hierarchical Bayesian Model to the same data,
# the upper FROC curve or AFROC curve, the better the AUC.
#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, even if curves are different readers and same modality, then color is same.
#6) If you want to see only data points, then by DrawFROCcurve = F, it will be done.
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 =F, 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 = T)
#The 2-nd modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 2,readerID = 1:4, new.imaging.device = F)
#The 3-rd modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 3,readerID = 1:4, new.imaging.device = F)
#The 4-th modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 4,readerID = 1:4, new.imaging.device = F)
#The 5-th modality with all readers 1,2,3,4:
DrawCurves(fit,modalityID = 5,readerID = 1:4, new.imaging.device = F)
# Draw for all pairs of modalities and readers:
DrawCurves(
modalityID = 1:fit@dataList$M,
readerID = 1:fit@dataList$Q,
StanS4class = fit
)
# Changea 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 fitting and drawing 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 run the stan funtion
#with data named "dat" and the author's Bayesian model.
fit <- fit_srsc(dat)
# Drawing the curves by
DrawCurves(fit)
# Changea 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()
# }
# NOT RUN {
# dottest
# }
Run the code above in your browser using DataLab