glmmTMB (version 0.2.3)

get_cor: translate vector of correlation parameters to correlation values, following the definition at http://kaskr.github.io/adcomp/classUNSTRUCTURED__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 = D^{-1/2} L L^\top D^{-1/2}\), where \(D = \textrm{diag}(L L^\top)\). For a single correlation parameter \(\theta_0\), this works out to \(\rho = \theta_0/\sqrt{1+\theta_0^2}\).

Description

translate vector of correlation parameters to correlation values, following the definition at http://kaskr.github.io/adcomp/classUNSTRUCTURED__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 = D^{-1/2} L L^\top D^{-1/2}\), where \(D = \textrm{diag}(L L^\top)\). For a single correlation parameter \(\theta_0\), this works out to \(\rho = \theta_0/\sqrt{1+\theta_0^2}\).

Usage

get_cor(theta)

Arguments

theta

vector of internal correlation parameters

Value

a vector of correlation values

Examples

Run this code
# NOT RUN {
th0 <- 0.5
stopifnot(all.equal(get_cor(th0),th0/sqrt(1+th0^2)))
get_cor(c(0.5,0.2,0.5))
# }

Run the code above in your browser using DataLab