Learn R Programming

GGMncv (version 1.0.0)

constrained: Constrained Precision Matrix

Description

Compute the maximum likelihood estimate, given certain elements are constrained to zero (e.g., an adjacency matrix). This approach is described in hastie2015statistical;textualGGMncv.

Usage

constrained(Sigma, adj)

Arguments

Sigma

Covariance matrix

adj

Matrix with contraints. A one indicates that element should be constrained to zero.

Value

A list containing the inverse covariance matrix and the covariance matrix.

Examples

Run this code
# NOT RUN {
# data
Y <- GGMncv::ptsd[,1:5]

# columns
p <- ncol(Y)

# contstraint matrix
constraints <- matrix(0,p,p)

# set one value to zero
constraints[2,3] <- 1
constraints[3,2] <-1

# estimate, given constraints
fit <- constrained(cor(Y), adj = constraints)
Theta <- fit$Theta
# }

Run the code above in your browser using DataLab