get_posterior_variance: Alternative of 'rstan::get_posterior_mean()'

Description Usage Arguments Value Examples

View source: R/get_posterior_variance.R

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

1
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 is a fitted model object as a return value of the function fit_Bayesian_FROC().

To be passed to DrawCurves() ... 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

 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
## Not run: 

        fit <- fit_Bayesian_FROC(BayesianFROC::dd,ite = 111)




             e <- rstan::extract(fit)




 # Check the retrun value is the desired one.


#    apply(e$z,   2,        var) ==  get_posterior_variance(fit,z)
#    apply(e$mu,  c(2,3),   var) ==  get_posterior_variance(fit,mu)
#    apply(e$v,   c(2,3),   var) ==  get_posterior_variance(fit,v)
#    apply(e$ppp, c(2,3,4), var) ==  get_posterior_variance(fit,ppp)

#This code is OK, but R CMD check might say error cuz the object
# z, mu, v, ppp is not found



# apply(e$z,   2,        var) ==  get_posterior_variance(fit,"z")
# apply(e$mu,  c(2,3),   var) ==  get_posterior_variance(fit,"mu")
# apply(e$v,   c(2,3),   var) ==  get_posterior_variance(fit,"v")
# apply(e$ppp, c(2,3,4), var) ==  get_posterior_variance(fit,"ppp")


 
## End(Not run)#dontrun

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