Skip to contents

A dependency-free correctness certificate for a fitted Gaussian graphical model. For the convex objective $$\min_{\Theta \succ 0} -\log\det\Theta + \mathrm{tr}(S\Theta) + \rho \sum_{i \neq j} |\Theta_{ij}|$$ (off-diagonal penalty), let \(W = \Theta^{-1}\). The subgradient optimality conditions are \(W_{ii} = S_{ii}\); \(W_{ij} - S_{ij} = \rho\,\mathrm{sign}(\Theta_{ij})\) where \(\Theta_{ij} \neq 0\); and \(|W_{ij} - S_{ij}| \le \rho\) otherwise. By strict convexity, a precision matrix with zero violation is the unique global optimum, so a near-zero return certifies correctness independently of any reference solver.

Usage

glasso_kkt(
  theta,
  cor_matrix,
  rho,
  active_tol = 1e-08,
  penalize_diagonal = FALSE
)

Arguments

theta

Precision matrix to test.

cor_matrix

Correlation / covariance the model was fit to.

rho

Scalar penalty.

active_tol

Magnitude above which an off-diagonal entry is "active".

penalize_diagonal

Was the diagonal penalized in the fit being graded? Default FALSE, matching ebic_glasso()'s default.

Value

Maximum absolute stationarity violation (scalar); 0 = exact optimum.

Details

When the penalty also applies to the diagonal (penalize_diagonal = TRUE, the objective adds \(\rho \sum_i |\Theta_{ii}|\)), the diagonal condition becomes \(W_{ii} = S_{ii} + \rho\). Grading a diagonally-penalized fit with the default would report a spurious violation of exactly \(\rho\), so this flag must match the fit being tested.

Examples

S <- 0.5^abs(outer(1:5, 1:5, "-"))
fit <- ebic_glasso(cor_matrix = S, n = 200)
glasso_kkt(fit$precision, S, fit$lambda)
#> [1] 7.168638e-11