initialiseG: Construct the initial G matrix

View source: R/glmm.R

initialiseGR Documentation

Construct the initial G matrix

Description

This function maps the variance estimates onto the full c x q levels for each random effect. This ensures that the matrices commute in the NB-GLMM solver. This function is included for reference, and should not be used directly

Usage

initialiseG(cluster_levels, sigmas, Kin = NULL)

Arguments

cluster_levels

A list containing the random effect levels for each variable

sigmas

A matrix of c X 1, i.e. a column vector, containing the variance component estimates

Kin

A matrix containing a user-supplied covariance matrix

Details

Broadcast the variance component estimates to the full c\*q x c\*q matrix.

Value

matrix of the full broadcast variance component estimates.

Author(s)

Mike Morgan & Alice Kluzer

Examples

data(sim_nbglmm)
random.levels <- list("RE1"=paste("RE1", levels(as.factor(sim_nbglmm$RE1)), sep="_"),
                      "RE2"=paste("RE2", levels(as.factor(sim_nbglmm$RE2)), sep="_"))
rand.sigma <- matrix(runif(2), ncol=1)
rownames(rand.sigma) <- names(random.levels)
big.G <- initialiseG(random.levels, rand.sigma)
dim(big.G)


MikeDMorgan/miloR documentation built on Feb. 29, 2024, 6:20 p.m.