Learn R Programming

BayesianFROC (version 1.0.0)

metadata_to_fit_MRMC_casewise: Create metadata for MRMC data

Description

The so-called false positive fraction (FPF) and the true positive fraction (TPF) are calculated from the number of hits (True Positives: TPs) and the number of false alarms (False Positives: FPs)

Usage

metadata_to_fit_MRMC_casewise(dataList, ModifiedPoisson = FALSE)

Arguments

dataList

A list, consisting of the following R objects:m,q,c,h,f,NL,C,M,Q each of which means from the right

caseID : A vector, indicating the case ID (image, radiograph, patient ... etc) = 1,2,... which does not include zero.

m : A vector, indicating the modality ID = 1,2,... which does not include zero.

q : A vector, indicating the reader ID = 1,2,... which does not include zero.

c : A vector, indicating the confidence = 1,2,... which does not include zero.

h : A vector, indicating the number of hits

f : A vector, indicating the number of false alarm

NL : A positive integer, indicating the number of lesions for all images

C : A positive integer, indicating the highest number of confidence level

M : A positive integer, indicating the number of modalities

Q : A positive integer, indicating the number of readers.

The detail of these dataset, please see the example datasets, e.g. dd.

ModifiedPoisson

Logical, that is TRUE or FALSE.

If ModifiedPoisson = TRUE, then Poisson rate of false alarm is calculated per lesion, and a 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 a 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

Value

A list, which includes arrays and vectors. A metadata such as number of cumulative false alarms and hits to create and draw the curve.

The False Positive Fraction (FPF) and True Positive Fraction (TPF) are also calculated.

The components of list I rediscover it at 2019 Jun 18, I am not sure it is useful? 2019 Dec 8

harray

An array of hit, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

farray

An array of false alarms, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

hharray

An array of cumulative hits, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

ffarray

An array of cumulative false alarms, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

hharrayN

An array of TPF, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

ffarrayN

An array of FPF, dimension [C,M,Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

h

An vector of hit, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

f

An vector of false alarms, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

hh

An vector of cumulative hits, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

ff

An vector of cumulative false alarms, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

hhN

An vector of TPF, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

ffN

An vector of FPF, dimension [C*M*Q], where C,M,Q are a number of confidence level, modalities, readers, respectively.

Revised Nov. 21

Details

To fit a model to data, we need a hit data and false data formulated by both an array and a vector.

It also calculates the so-called False Positive Fractions (FPF) (resp. True Positive Fractions (TPF) ) which are cumulative sums of false alarms (resp. hits) over number of lesions or images.

From data of number of hits and false alarms, we calculate the number of cumulative false positives and hits per image or lesion, in other words, False Positive Fraction (FPF) and True Positive Fraction (TPF). Since there are three subscripts, reader, modality, and image, we can create array format or vector format etc...

Abbreviations

FPF: false positive fraction

TPF: true positive fraction

hit : True Positive = TP

false alarms: False Positive = FP

The traditionaly, the so-called FPF;False Positive Fraction and TPT:True Positive Fraction are used. Recall that our data format:

A single reader and a single modality case

------------------------------------------------------------------------------------------------------

NI, NL confidence level No. of false alarms No. of hits
(FP:False Positive) (TP:True Positive)
----------------------- ----------------------- ----------------------------- -------------
definitely present 5 \(F_5\) \(H_5\)
probably present 4 \(F_4\) \(H_4\)
equivocal 3 \(F_3\) \(H_3\)
subtle 2 \(F_2\) \(H_2\)
very subtle 1 \(F_1\) \(H_1\)

---------------------------------------------------------------------------------------------------

FPF is defined as follows;

$$FPF(5):= \frac{F_5}{NI},$$ $$FPF(4):= \frac{F_4+F_5}{NI},$$ $$FPF(3):= \frac{F_3+F_4+F_5}{NI},$$ $$FPF(2):= \frac{F_2+F_3+F_4+F_5}{NI},$$ $$FPF(1):= \frac{F_1+F_2+F_3+F_4+F_5}{NI}.$$

TPF is defined as follows;

$$TPF(5):= \frac{H_5}{NL},$$ $$TPF(4):= \frac{H_4+H_5}{NL},$$ $$TPF(3):= \frac{H_3+H_4+H_5}{NL},$$ $$TPF(2):= \frac{H_2+H_3+H_4+H_5}{NL},$$ $$TPF(1):= \frac{H_1+H_2+H_3+H_4+H_5}{NL}.$$

Examples

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



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


#========================================================================================
#                           #Calculate FPFs and TPFs and etc.
#========================================================================================



                             a <- metadata_to_fit_MRMC(dat)


#Now, we get  a meta-data object named "a".


#========================================================================================
#                                 Check of Definiion
#========================================================================================


                                 a$hh/dat$NL == a$hhN

# Since all of aboves are TRUE, the hhN is a TPF per NL.




#========================================================================================
#                             Plot a FPFs and TPFs
#========================================================================================
#'



                                 FPF = a$ffN
                                 TPF = a$hhN

                               dark_theme()
                               plot(FPF,TPF)

#========================================================================================
#                             Plot a FPFs and TPFs via ggplot
#========================================================================================

                       length(dat$f)==length(FPF)

            q  <- dat$q
            m  <- dat$m
            df <- data.frame(FPF,
                             TPF,
                             m,
                             q
                             )

# ggplot2::ggplot(df, aes(x =FPF, y = TPF, colour = q, group = m)) + ggplot2::geom_point()

# Revised 2019 Jun 18, Revised 2019 Sept 9





# }

Run the code above in your browser using DataLab