We explain how the following FROC data arise from FROC task in this vignette.
Format of dataset for FROC analysis:
Confidence Level | No. of Hits | No. of False alarms |
---|---|---|
5 = definitely present | \(H_{5}\) | \(F_{5}\) |
4 = probably present | \(H_{4}\) | \(F_{4}\) |
3 = equivocal | \(H_{3}\) | \(F_{3}\) |
2 = probably absent | \(H_{2}\) | \(F_{2}\) |
1 = questionable | \(H_{1}\) | \(F_{1}\) |
Assume that there is
In FROC task, reader response the locations of suspicious shadows in image with his confidence level. If reader answer over all images, then by the gold standard, each readers answers are associated hit or false alarms whether or not reader correctly answer his locations on true lesions or not.
So, this manner, we get the FROC data. If image has some indicator function representing the category of imaging methods, then such case, data will be the multiple reader and multiple modality.
library(BayesianFROC)
#> Loading required package: rstan
#> Loading required package: ggplot2
#> Loading required package: StanHeaders
#> rstan (Version 2.18.2, GitRev: 2e1f913d3ca3)
#> For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores()).
#> To avoid recompilation of unchanged Stan programs, we recommend calling
#> rstan_options(auto_write = TRUE)
#> For improved execution time, we recommend calling
#> Sys.setenv(LOCAL_CPPFLAGS = '-march=native')
#> although this causes Stan to throw an error on a few processors.
#> Loading required package: Rcpp
#>
#>
#>
#> * The package "BayesianFROC" has been attached.
#>
#>
#>
#> -----------------------------------------------------------
#> ------------ Package: BayesianFROC ---------------------
#> -----------------------------------------------------------
#>
#>
#> *** Work Flow ***
#>
#> * STEP(1): Prepare Data
#> * STEP(2): Fitting FROC Statistical Models
#> * STEP(3): Draw FROC curve
#> * STEP(4): Validation of fitting model to data
#> * STEP(5): Plot Bi-Gaussian distributions
#>
#>
#>
#>
#> * Main procedure consists of STEP(1) and STEP(2).
#> * If only one fitted model object is specified in STEP(1) and STEP(2), a sequential analysis STEP(3), (4) and (5) is given for the fitted model.
#>
#>
#> STEP (1): Prepare Data
#> ( as an R object formulated for applying the function in this package)
#>
#>
#> * If you already have data formulated for a software JAFROC,
#> with its extension xlsx of the Microsoft Office,
#> then use "convertFromJafroc()"
#> in this package to convert the data file of xlsx extension
#> from Jafroc formulation to an R object for this package formluation.
#>
#> * If user dose not have any data yet, then please create an R object of your data
#> by using "dataset_creator_new_version()"
#> (or "create_dataset()") in this package.
#>
#>
#>
#> * Use one of the following to create user's own FROC data as an R object.
#>
#> +-- R Codes: Single reader and Single Modality --+
#> |
#> | * convertFromJafroc()
#> | * dataset_creator_new_version()
#> | * create_dataset()
#> +------------------------------------------------+
#>
#>
#>
#> * See also the following example data
#>
#> Example R objects for data : Single reader and Single Modality
#>
#> * dataList.Chakra.1.with.explantation
#> * dataList.Chakra.2
#> * dataList.Chakra.3
#>
#> Example R objects for data : Multiple reader and Multiple Modality
#>
#> * dataList.Chakra.Web
#>
#>
#>
#>
#>
#> STEP (2): Fitting FROC Statistical Models
#>
#> * Using an R object of data prepared in the STEP (1),
#> we can obtain a fitted model object of class inheriting from "stanfit"
#> by applying the function "fit_Bayesian_FROC()"
#>
#>
#>
#>
#> +--- R Codes-----------------------+
#> | |
#> | * fit_Bayesian_FROC() |
#> | |
#> +-----------------------------------+
#>
#>
#>
#>
#>
#>
#> STEP (3): Draw FROC curves
#>
#> * Using an R object obtained in the STEP (2),
#> we can plot FROC curves and AFROC curves
#> by "DrawCurves()" in this package.
#>
#>
#> +--- R Codes------------------------+
#> | |
#> | * DrawCurves() |
#> | |
#> +-----------------------------------+
#>
#>
#>
#>
#>
#>
#> STEP (4): Validation of resulting models for your data
#>
#> * Using an R object obtained in the STEP (2),
#> we can evaluate the chi square p-values
#> in Baeyesian Context
#> by "p_value_of_the_Bayesian_sense_for_chi_square_goodness_of_fit()" in this package.
#>
#>
#>
#> +--- R Codes--------------------------------------------------------+
#> | |
#> | * p_value_of_the_Bayesian_sense_for_chi_square_goodness_of_fit() |
#> | |
#> +--------------------------------------------------------------------+
#>
#>
#>
#> * Note that the chi square value in the plot plane
#> is calculated with posterior means.
#> On the other hand, this function calculate the chi square value
#> in purely Bayesian manner which is described
#> in the famous Gelmann's book " Bayesian Data Analysis".
#>
#> * There is a further validation implemeted
#> in validation.dataset_srsc_for_different_NI_NL() but
#> this validation is independent on users data,
#> so I think it is not important for users to know it.
#>
#>
#>
#>
#> STEP (5): Plot Bi-Gaussian distributions
#>
#> * Using the R S4 object obtained in the STEP (2),
#> we can plot the signal and the noise distribution
#> by "draw_bi_normal()" in this package.
#>
#>
#>
#> +--- R Codes--------------------------------------------------------+
#> | |
#> | * draw_bi_normal() |
#> | |
#> +--------------------------------------------------------------------+
#>
#>
#> ---- Minimal explanation of the package BayesianFROC finished !! ------------
#>
#> *** For More Details ***
#>
#> * Vignettes
#> * help()
#> * Demos
#>
#> * Please see examples codes in help(fit_Bayesian_FROC)
#> in which for the full details are given.
#>
#>
#> +--- R Codes-----------------------------------------------------+
#> | * demo(demo_MRMC,package="BayesianFROC")() |
#> | * demo(demo_srsc,package="BayesianFROC")() |
#> | * demo(demo_drawcurves_srsc,package="BayesianFROC")() |
#> | * demo(demo_stan,package="BayesianFROC") |
#> L-----------------------------------------------------------------+
#>
#>
#>
#> * Examples of R Codes:
#> [with pipe operator defined in the package library(magrittr) ]
#>
#> * First, prepare the pipe operator by the following code:
#>
#> `%>%` <- utils::getFromNamespace("%>%", "magrittr")
#>
#> I like pipe opeartor, since it does not require to create an R objects.
#> So, we can reduce the notations by using the pipe operator.
#>
#> * Create dataset and fitting
#>
#> dataset_creator_new_version() %>% fit_Bayesian_FROC()
#>
#>
#> * Fitting and draw the bi-normal assumption with example data
#>
#> dataList.Chakra.1 %>% fit_Bayesian_FROC() %>% draw_bi_normal()
#>
#>
#> * Fitting and evaluate the p-value of the Bayesian sence
#>
#> dataList.Chakra.1 %>% fit_Bayesian_FROC() %>% p_value_of_the_Bayesian_sense_for_chi_square_goodness_of_fit()
#>
#>
#>
#> * Fitting and drawing the FROC curves
#>
#> dataList.Chakra.Web %>% fit_Bayesian_FROC(ite = 111) %>% DrawCurves()
#>
#>
#>
#> * When user use the above scripts
#> with the user's own data object,
#> then run above code use the user own data
#> instead of the example data
#> such as dataList.Chakra.1, dataList.Chakra.Web.
#>
#>
#>
#>
#>
#> --- Inherited S4 Class ---
#> * The fitted model R object created by thefit_Bayesian_FROC()
#> is generated by "rstan" package,
#> but its class is not "stanfit",
#> but a certain extended (inherited) class from the class "stanfit".
#>
#> That is,
#> return value of rstan::sampling()
#> is an S4 object of the S4 class "stanfit".
#> On the other hand,
#> return value of BayesianFROC::fit_Bayesian_FROC()
#> is an S4 object of an inherited S4 class named "stanfitExtended".
#>
#>
#>
#> Thus to apply any functions of the rstan package for a fitted model object of the extended S4 class
#> (such as rstan::stan_dens(),rstan::stan_trace(),...),
#> we need to coerce the class of the object from the inherited class "stanfitExtended".
#> to the class "stanfit"
#> by the R script methods::as( object.obtained.in.STEP.(2), "stanfit") .
#> --- Questions ---
#>
#> * For any questions,
#> send me a mail (tsunoda.issei1111@gmail.com ).
#>
#> --- Job ---
#>
#>
#> * Could you employ me as data scientist ?
#> (Send me a mail to tsunoda.issei1111@gmail.com )
#> * My hobby is now to study differential geometry,
#> complex differential geometry,
#> Kodaira-Spencer deformation theory.
#>
#> -------------------Primary functions ---------------------
#> *convertFromJafroc()
#> *dataset_creator_new_version()
#> *create_dataset()
#> *fit_Bayesian_FROC()
#> *DrawCurves()
#> *p_value_of_the_Bayesian_sense_for_chi_square_goodness_of_fit()
#> *draw_bi_normal()
#> *
#> *
BayesianFROC::viewdata(d)
#>
#> * Number of Lesions: 259
#>
#> * Number of Images : 57
#>
#>
#> . Confidence.Level False.Positives True.Positives
#> ------------------- ----------------- ---------------- ---------------
#> Obviouly present 3 1 97
#> Relatively obvious 2 14 32
#> Subtle 1 74 31
#>
#>
#> * Higher number of confidence level indicates readers his higher confidence. In your case, the number 3 is the most high confidence level, i.e., we may say that confidence level 3 means that "definitely lesion is present "
library(BayesianFROC)
BayesianFROC::viewdata(dd)
#>
#> * Number of Lesions: 142
#>
#> * Number of Images is not assigned, not required to esimate.
#>
#> ----- Interpretation of the Table ------
#>
#> * The first row shows that the number of hits 50 and the number of false alarms 0 with the 1-th reader under the imaging method ID 1 with his confidence level 5.
#>
#>
#> ModalityID ReaderID Confidence.Level False.Positives True.Positives
#> ----------- --------- ----------------- ---------------- ---------------
#> 1 1 5 0 50
#> 1 1 4 4 30
#> 1 1 3 20 11
#> 1 1 2 29 5
#> 1 1 1 21 1
#> 1 2 5 0 15
#> 1 2 4 0 29
#> 1 2 3 6 29
#> 1 2 2 15 1
#> 1 2 1 22 0
#> 1 3 5 1 39
#> 1 3 4 15 31
#> 1 3 3 18 8
#> 1 3 2 31 10
#> 1 3 1 19 3
#> 1 4 5 1 10
#> 1 4 4 2 8
#> 1 4 3 4 25
#> 1 4 2 16 45
#> 1 4 1 17 14
#> 2 1 5 1 52
#> 2 1 4 1 25
#> 2 1 3 21 13
#> 2 1 2 24 4
#> 2 1 1 23 1
#> 2 2 5 1 27
#> 2 2 4 1 28
#> 2 2 3 5 29
#> 2 2 2 30 1
#> 2 2 1 40 0
#> 2 3 5 2 53
#> 2 3 4 19 29
#> 2 3 3 31 13
#> 2 3 2 56 2
#> 2 3 1 42 4
#> 2 4 5 2 9
#> 2 4 4 0 16
#> 2 4 3 2 22
#> 2 4 2 30 43
#> 2 4 1 32 14
#> 3 1 5 1 43
#> 3 1 4 7 29
#> 3 1 3 13 11
#> 3 1 2 28 6
#> 3 1 1 19 0
#> 3 2 5 0 18
#> 3 2 4 1 29
#> 3 2 3 7 21
#> 3 2 2 7 0
#> 3 2 1 31 0
#> 3 3 5 7 43
#> 3 3 4 15 29
#> 3 3 3 28 6
#> 3 3 2 41 7
#> 3 3 1 9 1
#> 3 4 5 0 10
#> 3 4 4 2 14
#> 3 4 3 5 19
#> 3 4 2 24 32
#> 3 4 1 31 23
#> 4 1 5 1 61
#> 4 1 4 4 19
#> 4 1 3 18 12
#> 4 1 2 21 9
#> 4 1 1 23 3
#> 4 2 5 1 16
#> 4 2 4 1 29
#> 4 2 3 0 34
#> 4 2 2 11 1
#> 4 2 1 35 0
#> 4 3 5 6 52
#> 4 3 4 14 29
#> 4 3 3 37 10
#> 4 3 2 36 4
#> 4 3 1 18 3
#> 4 4 5 0 10
#> 4 4 4 2 16
#> 4 4 3 4 23
#> 4 4 2 18 43
#> 4 4 1 25 15
#> 5 1 5 0 35
#> 5 1 4 2 29
#> 5 1 3 19 18
#> 5 1 2 23 9
#> 5 1 1 18 0
#> 5 2 5 0 17
#> 5 2 4 2 27
#> 5 2 3 6 24
#> 5 2 2 10 0
#> 5 2 1 30 0
#> 5 3 5 2 34
#> 5 3 4 25 33
#> 5 3 3 40 7
#> 5 3 2 29 13
#> 5 3 1 24 2
#> 5 4 5 1 12
#> 5 4 4 1 16
#> 5 4 3 4 21
#> 5 4 2 24 35
#> 5 4 1 32 15
see my paper in which proof reading had done and thus I think it is more easy to read. Good Luck !!
I have deseased many prurigo, it very …
I have to work, If there is job, please tell me.
In my package is independent to Rjafroc, but relates it. But now 2019 May, the Rjafroc is not on CRAN, so I cannot link to Rjafroc.
In my program completely independent to Rjafroc, so it is no problem wheter Rjafroc is on CRAN or not.