precgen2: precgen2

Description Usage Arguments Details Value Examples

View source: R/precgen2.R

Description

This function generates a precision matrix for a general 2-level Gaussian hierarchical model (level 0 being the root, and level 3 being the observations) given the variances for each level tau, tau_a, tau_b 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
precgen2(i, J, flat_prior = TRUE, tau = 1, tau_a = 1, tau_b = 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

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_ij 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
i <- 2
J <- c(1,3)
precgen2(i = i, J = J)

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