prec: Precision matrix parametrization helper functions.

View source: R/aaa_methods.R

LprecR Documentation

Precision matrix parametrization helper functions.

Description

Precision matrix parametrization helper functions.

Usage

Lprec(theta, p, ilowerL)

fillLprec(L, lfi)

theta2Lprec2C(theta, p, ilowerL)

Arguments

theta

numeric vector of length m.

p

numeric giving the dimention of Q. If missing, p = (1+sqrt(1+8*length(theta))) and Q is assumed to be dense.

ilowerL

numeric vector as index to (lower) L to be filled with theta. Default is missing and Q is assumed to be dense.

L

matrix as the lower triangle containing the Cholesky decomposition of a precision matrix

lfi

indicator of fill-in elements

Details

The precision matrix definition consider m parameters for the lower part of L. If Q is dense, then m = p(p-1)/2, else m = length(ilowerL). Then the precision is defined as Q(\theta) = L(\theta)L(\theta)^T

Value

matrix as the Cholesky factor of a precision matrix as the inverse of a correlation

a matrix whose elements at the lower triangle are the filled in elements of the Cholesky decomposition of a precision matrix and diagonal elements as 1:p.

Functions

  • fillLprec(): Function to fill-in a Cholesky matrix

  • theta2Lprec2C(): Internal function to build C

Examples

theta1 <- c(1, -1, -2)
Lprec(theta1)
theta2 <- c(0.5, -0.5, -1, -1)
Lprec(theta2, 4, c(2,4,7,12))

graphpcor documentation built on June 8, 2025, 10:37 a.m.

Related to prec in graphpcor...