# NOT RUN {
#========================================================================================
#             Model selection based on WAIC
#========================================================================================
# First, we prepare the data endowed with this package:
        dat  <- get(data("dataList.Chakra.1"))
# Second,  create a fitted model object;
          fit1 <- fit_Bayesian_FROC(dat,
                        ModifiedPoisson = FALSE)
# Using the fitted model object "fit", we can calculate the WAIC of it
                 waic(fit1)
# Fuerthermore,
# the Author provides an another model for a single reader and a single modality case.
# One is false alarm rates means "per lesion" and the other means "per image".
# The above "fit" is "per image".
# Now we shall consider to compare WAIC of these two models
# To do so, next we shall fit the "per lesion" model to the data as follows:
          fit2  <- fit_Bayesian_FROC(dat,
                        ModifiedPoisson = TRUE)
               waic(fit2)
# By compare two model's WAIC we can say which model is better.
# Note that the smaller WAIC is better.
           waic(fit1)     # per lesion model
           waic(fit2)    # per image model
# For the dataset,
# We should select one of the above two models
# by the criteria that the smaller waic is better.
# Namely, if the following inequality
                  waic(fit2) > waic(fit1)
#  is TRUE, then we should use fit1.
# Similary, if the following inequality
                 waic(fit2) < waic(fit1)
#  is TRUE, then we should use fit2.
# 2019.05.21 Revised.
# 2020 Feb Revised.
# }
# NOT RUN {
# dottest
# }
Run the code above in your browser using DataLab