chi_square_goodness_of_fit_from_input_all_param_MRMC: Chi square in the case of MRMC at a given dataset and a given...

Description Usage Arguments Value Examples

View source: R/chi_square_goodness_of_fit.R

Description

Given parameter and data, the chi square is calculated.

Usage

1
2
3
4
5
6

Arguments

ppp

An array of [C,M,Q], representing hit rate, where C,M,Q denotes the number of confidences, modalities, readers, respectively.

dl

An vector of length C M Q representing false alarm rate, where C,M,Q denotes the number of confidences, modalities, readers, respectively.

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:

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[1] = 5 f[1] = F_5 = 1 h[1] = H_5 = 41
probably present c[2] = 4 f[2] = F_4 = 2 h[2] = H_4 = 22
equivocal c[3] = 3 f[3] = F_3 = 5 h[3] = H_3 = 14
subtle c[4] = 2 f[4] = F_2 = 11 h[4] = H_2 = 8
very subtle c[5] = 1 f[5] = F_1 = 13 h[5] = 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

summary

Logical: TRUE of FALSE. Whether to print the verbose summary. 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 list, contains χ^2(Data|θ), where Data and θ are specified by user.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## Not run: 
#========================================================================================
#  0)
#========================================================================================

#        Chi square depends on data and model parameter, thus what we have to do is:
#        prepare data and parameter

#        In the follwoing, we use data named ddd as an example to be fitted a model,
#        and use  posterior mean estimates as model parameter.
#        To do so, we execute the following code
#        to run the HMC algorithm for the data named ddd



   fit <- fit_Bayesian_FROC(  dataList = ddd, ite = 51 )


#         In the resulting object named fit, the posterior samples are retained.

#========================================================================================
#  1)   hit rate and false alarm rate
#========================================================================================


         e   <- extract_estimates_MRMC(fit);
         dl  <- e$dl.EAP;
         ppp <- e$ppp.EAP;


#========================================================================================
# 2)  Calculates chi square using above hit rate and false alarm rate and data named ddd
#========================================================================================

         chi_square_goodness_of_fit_from_input_all_param_MRMC(ppp,dl,ddd)


## End(Not run)# dontrun

BayesianFROC documentation built on Jan. 23, 2022, 9:06 a.m.