get_cor: translate vector of correlation parameters to correlation...

View source: R/utils.R

get_corR Documentation

translate vector of correlation parameters to correlation values

Description

translate vector of correlation parameters to correlation values

Usage

get_cor(theta)

Arguments

theta

vector of internal correlation parameters (elements of scaled Cholesky factor, in row-major order)

Details

This function follows the definition at http://kaskr.github.io/adcomp/classdensity_1_1UNSTRUCTURED__CORR__t.html: if L is the lower-triangular matrix with 1 on the diagonal and the correlation parameters in the lower triangle, then the correlation matrix is defined as Sigma = sqrt(D) L L' sqrt(D), where D = diag(L L'). For a single correlation parameter theta0, this works out to rho = theta0/sqrt(1+theta0^2). The function returns the elements of the lower triangle of the correlation matrix, in column-major order.

Value

a vector of correlation values

Examples

th0 <- 0.5
stopifnot(all.equal(get_cor(th0),th0/sqrt(1+th0^2)))
get_cor(c(0.5,0.2,0.5))

glmmTMB documentation built on July 12, 2022, 5:06 p.m.