get_samples_from_Posterior_Predictive_distribution: Synthesizes Samples from Predictive Posterior Distributions...

Description Usage Arguments Details Value Examples

View source: R/p_value_of_the_Bayesian_sense_for_chi_square_goodness_of_fit.R

Description

Synthesizes samples from posterior predictive distributions.

Usage

1
2
3
4
5
6
7
8
9
get_samples_from_Posterior_Predictive_distribution(
  StanS4class,
  counter.plot.via.schatter.plot = TRUE,
  new.imaging.device = TRUE,
  upper_x,
  upper_y,
  Colour = TRUE,
  plot.replicated.points = TRUE
)

Arguments

StanS4class

An S4 object of class stanfitExtended which is an inherited class from the S4 class stanfit. This R object is a fitted model object as a return value of the function fit_Bayesian_FROC().

To be passed to DrawCurves() ... etc

counter.plot.via.schatter.plot

Logical: TRUE of FALSE. Whether counter plot via schatter plot is drawn, Default = TRUE.

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.

upper_x

A non-negative real number. This is a upper bound for the axis of the horisontal coordinate of FROC curve.

upper_y

A non-negative real number. This is a upper bound for the axis of the vertical coordinate of FROC curve.

Colour

Logical: TRUE of FALSE. whether Colour of curves is dark theme or not.

plot.replicated.points

TRUE or FALSE. If true, then plot replicated points (hits, false alarms) by the scatter plot. This process will takes a long times. So if user has no time, then FALSE will help you.

Details

This methods to draw from the PPD is described in Gelman book, Bayesian Data Analysis. The aim of this function is to evaluate the chi square test statistics as a Bayesian sense. According to Gelman book, the chi square test need the samples from the PPD. So, we use this function to accomplish this task.

Value

A list of datalists from the posterior predictive distribution

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 ## Not run: 



 fit <- fit_Bayesian_FROC(
  ite  = 1111,
   summary = FALSE ,
  dataList = BayesianFROC::dataList.Chakra.1 )





#=======  The first example ======================================================
 TPs.FPs <- get_samples_from_Posterior_Predictive_distribution(fit)


#=======  The Second Example: Short cut    ===========================================
# If user has no time, then  plot.replicated.points=FALSE will help you.
# By setting FALSE, the replicated data from the posterior predictive
# distribution does not draw, and hence the running time of function become shorter.

 TPs.FPs <- get_samples_from_Posterior_Predictive_distribution(fit,
                                   plot.replicated.points =  FALSE)





#      Close the graphic device to avoid errors in R CMD check.

     grDevices::dev.new();plot(stats::runif(100),stats::runif(100))



#================The third example:  From Hand made data to fitting  ==========
#  To draw the scatter plots of hits and false alarms synthesized from the posterior
#  predictive distribution for the submission to a journal,
#  then the colored plot is not appropriate.
#  So, by setting the argument Colour = FALSE, the scatter plot colored by black and white.
#  we use the resulting plot for submission.


 get_samples_from_Posterior_Predictive_distribution(fit,Colour = FALSE)

  g <-get_samples_from_Posterior_Predictive_distribution(fit)

  x <- g$CFP

  y <- g$CTP


 plot(   hexbin::hexbin(unlist(x),unlist(y))   )



#      Close the graphic device to avoid errors in R CMD check.

         Close_all_graphic_devices()

## End(Not run)# dottest

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