Learn R Programming

graphpcor (version 0.1.12)

Lprec: Precision matrix parametrization helper functions.

Description

Precision matrix parametrization helper functions.

Usage

Lprec(theta, p, ilowerL)

fillLprec(L, lfi)

theta2Lprec2C(theta, p, ilowerL)

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.

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

Functions

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

  • theta2Lprec2C(): Internal function to build C

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\)

Examples

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

Run the code above in your browser using DataLab