Learn R Programming

BayesianFROC (version 0.2.1)

waic: WAIC calculator

Description

Using the fitted object of class satnfit whose stan file described using target += , the function calculates the WAIC.

Usage

waic(StanS4classwithTargetFormulation, dig = 4, summary = TRUE)

Arguments

StanS4classwithTargetFormulation

This is a fitted model object built by rstan::sampling() whose model block is described by target formulation function in the rstan package. This object is avaliable both S4 class, stanfit and stanfitExtended.

In this package, we make a new S4 class stanfitExtended which is inherited class of rstan's S4 class named "stanfit". This function is available for stanfit S4 object.

dig

The number of significant digits of waic.

summary

Logical: TRUE of FALSE. Whether to print the verbose summary, i.e., logical; 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.

Value

A real number, representing the value of WAIC.

Examples

Run this code
# NOT RUN {
# First, we prepare the data endowed with this package:

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




# Second,  create a fitted model object;

            fit <- fit_Bayesian_FROC(dat, PreciseLogLikelihood = TRUE)



# Using the fitted model object "fit", we obtain the WAIC



                 waic(fit)



#The Author provide two model for FROC 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 these two model
#by WAIC. To do so, next we shall fit the "per lesion" model as follows:

fit2 <- fit_Bayesian_FROC(dat, PreciseLogLikelihood = TRUE, 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(fit)     # per lesion model
waic(fit2)    # per image model



# 2019.05.21 Revised.
# }
# NOT RUN {
# dottest
# }

Run the code above in your browser using DataLab