Bmchoice {bmstdr}R Documentation

Model choice criteria calculation for univariate normal model for both known and unknown sigma^2

Description

Model choice criteria calculation for univariate normal model for both known and unknown sigma^2

Usage

Bmchoice(
  case = "Exact.sigma2.known",
  y = ydata,
  mu0 = mean(y),
  sigma2 = 22,
  kprior = 1,
  prior.M = 1,
  prior.sigma2 = c(2, 1),
  N = 10000,
  rseed = 44
)

Arguments

case

One of the three cases:

  • "Exact.sigma2.known": Use exact theoretical calculation.

  • "MC.sigma2.known": Use Monte Carlo methods for drawing samples from the posterior assuming known sigma2.

  • "MC.sigma2.unknown": Use the Gibbs sampler to generate samples from the joint posterior distribution of theta and sigma^2.

y

A vector of data values. Default is 28 ydata values from the package bmstdr

mu0

The value of the prior mean if kprior=0. Default is the data mean.

sigma2

Value of the known data variance; defaults to sample variance of the data. This is ignored in the third case when sigma2 is assumed to be unknown.

kprior

A scalar providing how many data standard deviation the prior mean is from the data mean. Default value is 0.

prior.M

Prior sample size, defaults to 10^(-4).

prior.sigma2

Shape and scale parameter value for the gamma prior on 1/sigma^2, the precision.

N

The number of samples to generate.

rseed

The random number seed. Defaults to 44 to reproduce the results in the book Sahu (2022).

Value

A list containing the exact values of pdic, dic, pdicalt, dicalt, pwaic1, waic1, pwaic2, waic2, gof, penalty and pmcc. Also prints out the posterior mean and variance. @references Sahu SK (2022). Bayesian Modeling of Spatio Temporal Data with R, 1st edition. Chapman and Hall, Boca Raton. https://doi.org/10.1201/9780429318443.

Examples

Bmchoice()
b1 <- Bmchoice(case="Exact.sigma2.known")
b2 <- Bmchoice(case="MC.sigma2.known")
d1 <- Bmchoice(case="MC.sigma2.unknown")
d2 <- Bmchoice(y=rt(100, df=8),  kprior=1, prior.M=1)


[Package bmstdr version 0.7.9 Index]