# draw.CFP.CTP.from.dataList: Plot the pairs of CFPs and CTPs In BayesianFROC: FROC Analysis by Bayesian Approaches

## Description

It plot the emipirical FROC curves (not depicted the line).

## Usage

 1 2 3 4 5 draw.CFP.CTP.from.dataList( dataList, ModifiedPoisson = FALSE, new.imaging.device = TRUE ) 

## Arguments

dataList

A list, specifying an FROC data to be fitted a model. It consists of data of numbers of TPs, FPs, lesions, images. .In addition, if in case of mutiple readers or mutiple modalities, then modaity ID and reader ID are included also.

The dataList will be passed to the function rstan::sampling() of rstan. This is a variable in the function rstan::sampling() in which it is named data.

For the single reader and a single modality data, the dataList is made by the following manner:

 dataList.Example <- list(

 h = c(41,22,14,8,1), # number of hits for each confidence level

 f = c(1,2,5,11,13), # number of false alarms for each confidence level

 NL = 124, # number of lesions (signals)

 NI = 63, # number of images (trials)

 C = 5) # number of confidence, .. the author thinks it can be calculated as the length of h or f ...? ha, why I included this. ha .. should be omitted.

Using this object dataList.Example, we can apply fit_Bayesian_FROC() such as fit_Bayesian_FROC(dataList.Example).

To make this R object dataList representing FROC data, this package provides three functions:

 convertFromJafroc()

If data is a JAFROC xlsx formulation.

 dataset_creator_new_version()

Enter TP and FP data by table .

 create_dataset()

Enter TP and FP data by interactive manner.

Before fitting a model, we can confirm our dataset is correctly formulated by using the function  viewdata().

—————————————————————————————-

A Single reader and a single modality (SRSC) case.

—————————————————————————————-

In a single reader and a single modality case (srsc), dataList is a list consisting of f, h, NL, NI, C where f, h are numeric vectors and NL, NI, C are positive integers.

f

Non-negative integer vector specifying number of false alarms associated with each confidence level. The first component corresponding to the highest confidence level.

h

Non-negative integer vector specifying number of Hits associated with each confidence level. The first component corresponding to the highest confidence level.

NL

A positive integer, representing Number of Lesions.

NI

A positive integer, representing Number of Images.

C

A positive integer, representing Number of Confidence level.

The detail of these dataset, see the datasets endowed with this package. 'Note that the maximal number of confidence level, denoted by C, are included, however, Note that confidence level vector c  should not be specified. If specified, will be ignored , since it is created by  c <-c(rep(C:1)) in the inner program and do not refer from user input data, where C is the highest number of confidence levels. So, you should write down your hits and false alarms vector so that it is compatible with this automatically created c vector.

data Format:

A single reader and a single modality case

——————————————————————————————————

 NI=63,NL=124 confidence level No. of false alarms No. of hits In R console ->  c f  h ----------------------- ----------------------- ----------------------------- ------------- definitely present c = 5 f = F_5 = 1 h = H_5 = 41 probably present c = 4 f = F_4 = 2 h = H_4 = 22 equivocal c = 3 f = F_3 = 5 h = H_3 = 14 subtle c = 2 f = F_2 = 11 h = H_2 = 8 very subtle c = 1 f = F_1 = 13 h = H_1 = 1

—————————————————————————————————

* false alarms = False Positives = FP

* hits = True Positives = TP

Note that in FROC data, all confidence level means present (diseased, lesion) case only, no confidence level indicating absent. Since each reader marks his suspicious location only if he thinks lesions are present, and marked positions generates the hits or false alarms, thus each confidence level represents that lesion is present. In the absent case, reader does not mark any locations and hence, the absent confidence level does not relate this dataset. So, if reader think it is no lesion, then in such case confidence level is not needed.

Note that the first column of confidence level vector c  should not be specified. If specified, will be ignored , since it is created by  c <-c(rep(C:1)) automatically in the inner program and do not refer from user input data even if it is specified explicitly, where C is the highest number of confidence levels. So you should check the compatibility of your data and the confidence level vector  c <-c(rep(C:1)) via a table which can be displayed by the function viewdata().

—————————————————————————————

Multiple readers and multiple modalities case, i.e., MRMC case

—————————————————————————————

In case of multiple readers and multiple modalities, i.e., MRMC case, in order to apply the function fit_Bayesian_FROC(), dataset represented by an R list object representing FROC data must contain components m,q,c,h,f,NL,C,M,Q.

C

A positive integer, representing the highest number of confidence level, this is a scalar.

M

A positive integer vector, representing the number of modalities.

Q

A positive integer, representing the number of readers.

m

A vector of positive integers, representing the modality ID vector.

q

A vector of positive integers, representing the reader ID vector.

c

A vector of positive integers, representing the confidence level. This vector must be made by rep(rep(C:1), M*Q)

h

A vector of non-negative integers, representing the number of hits.

f

A vector of non-negative integers, representing the number of false alarms.

NL

A positive integer, representing the Total number of lesions for all images, this is a scalar.

Note that the maximal number of confidence level (denoted by C) are included in the above R object. However, each confidence level vector is not included in the data, because it is created automatically from C. To confirm false positives and hits are correctly ordered with respect to the automatically generated confidence vector,

the function viewdata() shows the table. Revised 2019 Nov 27 Revised 2019 Dec 5

Example data.

Multiple readers and multiple modalities ( i.e., MRMC)

—————————————————————————————————

 Modality ID Reader ID Confidence levels No. of false alarms No. of hits. m  q c  f  h -------------- ------------- ------------------------ ------------------- ---------------- 1 1 3 20 111 1 1 2 29 55 1 1 1 21 22 1 2 3 6 100 1 2 2 15 44 1 2 1 22 11 2 1 3 6 66 2 1 2 24 55 2 1 1 23 1 2 2 3 5 66 2 2 2 30 55 2 2 1 40 44

—————————————————————————————————

* false alarms = False Positives = FP

* hits = True Positives = TP

ModifiedPoisson

Logical, that is TRUE or FALSE.

If ModifiedPoisson = TRUE, then Poisson rate of false alarm is calculated per lesion, and model is fitted so that the FROC curve is an expected curve of points consisting of the pairs of TPF per lesion and FPF per lesion.

Similarly,

If ModifiedPoisson = TRUE, then Poisson rate of false alarm is calculated per image, and model is fitted so that the FROC curve is an expected curve of points consisting of the pair of TPF per lesion and FPF per image.

For more details, see the author's paper in which I explained per image and per lesion. (for details of models, see vignettes , now, it is omiited from this package, because the size of vignettes are large.)

If ModifiedPoisson = TRUE, then the False Positive Fraction (FPF) is defined as follows (F_c denotes the number of false alarms with confidence level c )

\frac{F_1+F_2+F_3+F_4+F_5}{N_L},

\frac{F_2+F_3+F_4+F_5}{N_L},

\frac{F_3+F_4+F_5}{N_L},

\frac{F_4+F_5}{N_L},

\frac{F_5}{N_L},

where N_L is a number of lesions (signal). To emphasize its denominator N_L, we also call it the False Positive Fraction (FPF) per lesion.

On the other hand,

if ModifiedPoisson = FALSE (Default), then False Positive Fraction (FPF) is given by

\frac{F_1+F_2+F_3+F_4+F_5}{N_I},

\frac{F_2+F_3+F_4+F_5}{N_I},

\frac{F_3+F_4+F_5}{N_I},

\frac{F_4+F_5}{N_I},

\frac{F_5}{N_I},

where N_I is the number of images (trial). To emphasize its denominator N_I, we also call it the False Positive Fraction (FPF) per image.

The model is fitted so that the estimated FROC curve can be ragraded as the expected pairs of FPF per image and TPF per lesion (ModifiedPoisson = FALSE )

or as the expected pairs of FPF per image and TPF per lesion (ModifiedPoisson = TRUE)

If ModifiedPoisson = TRUE, then FROC curve means the expected pair of FPF per lesion and TPF.

On the other hand, if ModifiedPoisson = FALSE, then FROC curve means the expected pair of FPF per image and TPF.

So,data of FPF and TPF are changed thus, a fitted model is also changed whether ModifiedPoisson = TRUE or FALSE. In traditional FROC analysis, it uses only per images (trial). Since we can divide one image into two images or more images, number of trial is not important. And more important is per signal. So, the author also developed FROC theory to consider FROC analysis under per signal. One can see that the FROC curve is rigid with respect to change of a number of images, so, it does not matter whether ModifiedPoisson = TRUE or FALSE. This rigidity of curves means that the number of images is redundant parameter for the FROC trial and thus the author try to exclude it.

Revised 2019 Dec 8 Revised 2019 Nov 25 Revised 2019 August 28

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.

## Value

CFPs and CTPs

plot_FPF_and_TPF_from_a_dataset()
plot_FPF_TPF_via_dataframe_with_split_factor()
 1  draw.CFP.CTP.from.dataList(dataList.Chakra.1)