centered_gibbs3: centered_gibbs3

Description Usage Arguments Details Value Examples

View source: R/centered_gibbs3.R

Description

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

Usage

1
2
centered_gibbs3(i, j, k, ndraws, burnin, flat_prior = TRUE, tau = 1,
  tau_a = 1, tau_b = 1, tau_c = 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

k

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

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

tau_c

variance for parameters in level 3

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
6
i <- 2
j <- 3
k <- 2
ndraws <- 10000
burnin <- 1000
centered_gibbs3(i = i, j = j, k = k, ndraws = ndraws, burnin = burnin)

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