Learn R Programming

BayesianFROC (version 0.3.0)

extract_EAP_CI: MRMC: Extract Estimates of a vector from stanfitExtended object

Description

We extract the EAPs and CIs from the stanfitExtended S4 class which is an inherited class of the stanfit S4 class.

Usage

extract_EAP_CI(
  StanS4class,
  parameter.name,
  dimension.of.parameter,
  dig = 5,
  summary = TRUE
)

Arguments

StanS4class

An S4 object of the class stanfit. No need that it is the S4 class stanfitExtended.

parameter.name

character vector. E.g., use as "aaa" . for names of parameter described in the parameter block of stan file.

dimension.of.parameter

If parameter aaa is vector, i.e.,aaa[1],aaa[2],...aaa[6] then dimension.of.parameter = 6

dig

A variable to be passed to the function rstan::sampling() of rstan in which it is named ...??. A positive integer representing the Significant digits, used in stan Cancellation. Default = 5,

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

EAPs, CI.

Details

To validate our model has no bias, that is comparison of true parameters of distributions and EAPs, we have to extract the estimates from the stanfitExtended object. And this function do it.

See Also

extract_estimates_MRMC

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# First we create the following fitted model object of  class stanfitExtend.


   fit <- fit_Bayesian_FROC(
                       BayesianFROC::dataList.Chakra.Web.orderd, # data
                              ite = 1111,                        # MCMC iteration
                              summary = FALSE                    # vervose
   )



# Second, to extract the EAPs of the parameter z,
# we also have to specify the dimension of vector z as follows.


       extract_EAP_CI(

                 fit,  #  The above fitted model object
                 "z",  #  The parameter name described in parameter block of stan file
                  5    #  The dimension of vector z
                      )



# One more example: to extract the EAPs of the parameter dz,
# we also have to specify its dimension of vector dz as follows.

          list.of.dz <-extract_EAP_CI(fit,"dz",4)

# One more example: to extract the EAPs of the parameter w,
#     we also have to specify its dimension of vector w as follows.

           list.w  <-extract_EAP_CI(fit,"w",1)


# Note that this function can extract only parameter of "vector" and not "array" !!
# To extract such array please use "extract_estimates_MRMC()"
# which extract all parameters from a hierarchical Bayesian model
# estimated from user data. So, this function is no longer meaningless,
# and I will delete this.


# I forgot where I use this function
# 2019.05.21 Revised.



#========================================================================================
#           the following gives convergence seed 2019 Oct 12
#========================================================================================
#'

f <- fit_Bayesian_FROC( ite  = 1111,  cha = 1, summary = TRUE, dataList = ddd ,see = 123456)
  z <- extract_EAP_CI(f,"z",f@dataList$C )$z.EAP
  #usethis::use_data(z)
  #usethis package cannot be to use since it is not declared in NAMESPACE.


  dz <- extract_EAP_CI(f,"dz",f@dataList$C-1 )$dz.EAP
  #usethis::use_data(dz)
  #usethis package cannot be to use since it is not declared in NAMESPACE.
# }
# NOT RUN {
# dottest



# }

Run the code above in your browser using DataLab