Learn R Programming

BayesianFROC (version 0.2.1)

get_posterior_variance: (UNDER CONSTRUCTION) Alternative of rstan::get_posterior_mean()

Description

This function is underconstruction. I validate only the example of this function. For MRMC case, I have to write or modify code. 2019 Sept 6

Usage

get_posterior_variance(StanS4class, name.of.parameter)

Arguments

StanS4class

An S4 object of class stanfitExtended which is an inherited class from the S4 class stanfit. This R object can be passed to the DrawCurves(), ppp() and ... etc

name.of.parameter

An parameter name (given as a character string, should not surround by ""). The name of parameter which user want to extract. Parameters are contained in the parameter block of each Stan file in the path: inst/extdata.

Value

variance or posterior parameters, if it is an array, then return is also an array.

Examples

Run this code
# NOT RUN {


# }
# NOT RUN {
        fit <- fit_Bayesian_FROC(BayesianFROC::dd)




             e <- rstan::extract(fit)




 # Check the retrun value is desired one.


   apply(e$z, 2, var) ==  get_posterior_variance(fit,z)

             var(e$m) ==  get_posterior_variance(fit,m)

             var(e$v) ==  get_posterior_variance(fit,v)






 
# }
# NOT RUN {
#donttest





# }

Run the code above in your browser using DataLab