known.graph: Re-fit Network

View source: R/known.graph.R

known.graphR Documentation

Re-fit Network

Description

Refits a network with unregularized partial correlations based on some known graph (perhaps estimated with a regularization method) following Hastie, Tibshirani, and Friedman (2008)

Usage

known.graph(S, A, method = c("glasso", "HTF"), tol = 0.000001, max.iter = 100)

Arguments

S

Matrix. Covariance or correlation matrix

A

Adjacency matrix. Unweighted network structure where 1 is an edge present and 0 is an edge absent

method

Character (length = 1). Whether to use the glasso method without penalization or the HTF (Haste, Tibshirani, & Friedman, 2008) method. Defaults to "glasso", which tends to be more robust

tol

Numeric (length = 1). Tolerance for convergence. The algorithm stops when the maximum absolute change in covariance matrix elements between iterations is less than tol. Defaults to 1e-06

max.iter

Numeric (length = 100). Maximum number of iterations to achieve tolerance before stopping

Value

Returns a list containing:

network

Estimated network

W

Estimated covariance matrix

Theta

Estimated inverse covariance matrix

iterations

Number of iterations to converge (or maximum if it did not)

converged

Whether the algorithm converged

Author(s)

Hudson Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>,

References

HTF Implementation on p. 631–634
Hastie, T., Tibshirani, R., & Friedman, J. (2008). The elements of statistical learning: Data mining, inference, and prediction (2nd ed.). New York, NY: Springer.

Examples

# Obtain data
wmt <- depression[,24:44]

# Obtain correlation matrix
wmt_R <- auto.correlate(wmt)

# Estimate network
wmt_network <- network.estimation(wmt_R, n = nrow(wmt))

# Obtain adjacency
wmt_A <- wmt_network
wmt_A[] <- ifelse(wmt_A != 0, 1, 0)

# Obtain unregularized estimate
wmt_unreg <- known.graph(S = wmt_R, A = wmt_A)


EGAnet documentation built on April 13, 2026, 5:07 p.m.