centered_gibbs2: centered_gibbs2

Description Usage Arguments Details Value Examples

View source: R/centered_gibbs2.R

Description

Gibbs sampler for centered 2-level Gaussian hierarchical model according to derived full conditionals

Usage

1
2
centered_gibbs2(i, j, ndraws, burnin, flat_prior = TRUE, tau = 1,
  tau_a = 1, tau_b = 1, sigma_2 = 1)

Arguments

i

number of nodes at level 1

j

number of children nodes in level 2 per node at level 1

ndraws

number of samples the user wants to have

burnin

number of samples to throw away at the start as the gibbs sampler warms up

flat_prior

determines whether to use the density with flat prior

tau

variance of the root (level 0)

tau_a

variance for parameters in level 1

tau_b

variance for parameters in level 2

sigma_2

variance of the observations

Details

Assumptions: - variances are constant for parameters within the same level - all observations y_ijk are equal to 0 - the mean of the root parameter B is mu = 0 - assume a naive sampler where the variances are not updated

Value

list of means and the samples

Examples

1
2
3
4
5
i <- 2
j <- 3
ndraws <- 10000
burnin <- 1000
centered_gibbs2(i = i, j = j, ndraws = ndraws, burnin = burnin)

kwajiehao/ghInf documentation built on May 7, 2019, 10:58 a.m.