GetStats: Retrieves basic Bayesian estimates from a generated chain

Description Usage Arguments Value Author(s) See Also Examples

View source: R/postgen_ops.R

Description

The function returns the posterior mean and Credible Set for a parameter based on a chain of posterior realizations.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#GetStats

Usage

1
GetStats(chain, alpha = 0.05)

Arguments

chain

A Markov Chain (a vector) containing the posterior realizations of the parameter.

alpha

Level to use for the credible set.

Value

A list containing the min, max, mean, Credible Set and CredibleSetConfidence level.

Author(s)

Sakis Micheas

See Also

normmix, to_int_surf, rsppmix, est_mix_damcmc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
truemix <- normmix(ps=c(.4, .2,.4), mus=list(c(0.3, 0.3), c(.5,.5),c(0.7, 0.7)),
 sigmas = list(.02*diag(2), .05*diag(2), .01*diag(2)))
intsurf=to_int_surf(truemix,lambda = 100, win = spatstat::square(1))
pp1 <- rsppmix(intsurf)
fit <- est_mix_damcmc(pp1, 3)
p1=GetStats(fit$genps[,1])
p1$Mean
p1$CredibleSet
p2=GetStats(fit$genps[,2])
p2$Mean
p2$CredibleSet
p3=GetStats(fit$genps[,3])
p3$Mean
p3$CredibleSet

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.