Description Usage Arguments Details Value Examples

View source: R/chi_square_goodness_of_fit.R

**('; ω;')**
The so-called

`h,f,NI,NL`

which mean the number of hits, false alarms, images and trials.
`p, lambda`

.
Holy moly, I write this without any tips, lemonades and coffee!
I love you. Today 2020 Oct 19, MCS symptoms is basically not bad, but, still aches in muscles, legs, why?
for 3 years, too long to be patient.
1 2 3 4 5 6 7 8 9 10 11 | ```
chi_square_goodness_of_fit_from_input_all_param(
h,
f,
p,
lambda,
NL,
NI,
ModifiedPoisson = FALSE,
dig = 3,
is_print_each_ratings_wise = FALSE
)
``` |

`h` |
A vector of non-negative integers, indicating the number of hits. The reason why the author includes this variable is to substitute the false alarms from the posterior predictive distribution. In famous Gelman's book, we can access how to make test statistics in the Bayesian context, and it require the samples from posterior predictive distribution. So, using this variable author substitute the replication data from the posterior predictive distributions. |

`f` |
A vector of non-negative integers, indicating the number of false alarms. The reason why the author includes this variable is to substitute the false alarms from the posterior predictive distribution. In famous Gelman's book, he explain how to make test statistics in the Bayesian context, and it require the samples from posterior predictive distribution. So, in this variable author substitute the replication data from the posterior predictive distributions. |

`p` |
A vector of non-negative integers, indicating hit rate. A vector whose length is number of confidence levels. |

`lambda` |
A vector of non-negative integers, indicating False alarm rate. A vector whose length is number of confidence levels. |

`NL` |
An integer, representing Number of Lesions |

`NI` |
An integer, representing Number of Images |

`ModifiedPoisson` |
Logical, that is If .
per lesionSimilarly, If .
per imageFor more details, see the author's paper in which I explained If
where On the other hand, if
where 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 ( or as the expected pairs of FPF per image and TPF per lesion ( If On the other hand, if So,data of FPF and TPF are changed thus, a fitted model is also changed whether Revised 2019 Dec 8 Revised 2019 Nov 25 Revised 2019 August 28 |

`dig` |
A variable to be passed to the function |

`is_print_each_ratings_wise` |
A logical, whether result is printed on the R/R-studio console. |

statistics for each MCMC sample with a fixed dataset.

Our data is 2C categories, that is,

the number of hits :h[1], h[2], h[3],...,h[C] and

the number of false alarms: f[1],f[2], f[3],...,f[C].

Our model has C+2 parameters, that is,

the thresholds of the bi normal assumption z[1],z[2],z[3],...,z[C] and

the mean and standard deviation of the signal distribution.

So, the degree of freedom of this statistics is calculated by

2C-(C+2)-1 =C -3.

This differ from Chakraborty's result C-2. Why ?

**Remak on the verification of codes**
To tell the truth, the author doubt that the calculation of ppp in this pkg is incorrect.
But I cannot reveal where I am wrong. Or, I cannot exculde in 100
The result of ppp() is sometimes reasonable but sometimes it is against my cute intuition.
Of curse, I am pretty cute, but why .... Uhnnn I am not sure wheter I am correct.
So, ha. Today (2020 Oct 19), I checked the code, but it looked correct.

A number! Not list nor data-frame nor vector! Only A number represent the chi square for your input data.

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:
# Makes a stanfit object (more precisely its inherited S4 class object)
fit <- fit_Bayesian_FROC(BayesianFROC::dataList.Chakra.1,
ite = 1111,
summary =FALSE,
cha = 2)
# Calculates the chi square discrepancies (Goodness of Fit)
# with the posterior mean as a parameter.
NI <- fit@dataList$NI
NL <- fit@dataList$NL
f.observed <- fit@dataList$f
h.observed <- fit@dataList$h
C <- fit@dataList$C
# p <- rstan::get_posterior_mean(fit, par=c("p"))
# lambda <- rstan::get_posterior_mean(fit, par=c("l"))
# Note that get_posterior_mean is not a number but a matrix when
# Chains is not 1.
# So, instead of it, we use
#
e <- extract_EAP_CI(fit,"l",fit@dataList$C )
lambda <- e$l.EAP
e <- extract_EAP_CI(fit,"p",fit@dataList$C )
p <- e$p.EAP
Chi.Square <- chi_square_goodness_of_fit_from_input_all_param(
h = h.observed,
f = f.observed,
p = p,
lambda = lambda,
NL = NL,
NI = NI
)
# Get posterior mean of the chi square discrepancy.
Chi.Square
# Calculate the p-value for the posterior mean of the chi square discrepancy.
stats::pchisq(Chi.Square,df=1)
# Note that the use of pchisq is fucking in Bayesian context,
# so, the pretty cute author made a function to calculate p value in the Bayesian sense.
# It is named ppp().
## End(Not run)# dottest
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.