Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_cor

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

Details

This function follows 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 = 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

Generalized Linear Mixed Models using Template Model Builder

v1.0.2.1
AGPL-3
Authors
Arni Magnusson [aut] (<https://orcid.org/0000-0003-2769-6741>), Hans Skaug [aut], Anders Nielsen [aut] (<https://orcid.org/0000-0001-9683-9262>), Casper Berg [aut] (<https://orcid.org/0000-0002-3812-5269>), Kasper Kristensen [aut], Martin Maechler [aut] (<https://orcid.org/0000-0002-8685-9910>), Koen van Bentham [aut], Ben Bolker [aut] (<https://orcid.org/0000-0002-2127-0443>), Nafis Sadat [ctb] (<https://orcid.org/0000-0001-5715-616X>), Daniel Lüdecke [ctb] (<https://orcid.org/0000-0002-8895-3206>), Russ Lenth [ctb], Joseph O'Brien [ctb] (<https://orcid.org/0000-0001-9851-5077>), Mollie Brooks [aut, cre] (<https://orcid.org/0000-0001-6963-8326>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.