precgen3: precgen3

Description Usage Arguments Details Value Examples

View source: R/precgen3.R

Description

This function generates a precision matrix for a general 3-level Gaussian hierarchical model (level 0 being the root, and level 4 being the observations) given the variances for each level tau, tau_a, tau_b, tau_c, and sigma_2. It takes advantage of the sparse structure of the precision matrix for centered 2-level gaussian hierarchical models and returns only the non-zero entries of the precision matrix together with its corresponding indices.

Usage

1
2
precgen3(i, J, K, 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

vector specifying the number of children nodes in level 2 per node at level 1

K

vector specifying the number of children nodes in level 3 per node at level 2

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

Value

list of non-zero entries of the precision matrix together with its corresponding indices

Examples

1
2
3
4
i <- 2
J <- c(1,3)
K <- c(1,2,3,4)
precgen3(i = i, J = J, K = K)

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