Complete a weighted adjacency to an SPD precision
Source:R/02_02_generate_synthetic_networks.R
build_normalised_precision.RdApplies a uniform spectral shift that preserves off-diagonal signs and
support:
$$
\boldsymbol{\Omega}
=
\boldsymbol{W}
+
\bigl(\lvert\min(0,\lambda_{\min}(\boldsymbol{W}))\rvert + u\bigr)
\mathbf{I}.
$$
The result is checked with base::chol(); if a factor still fails
(ill-conditioned graphs), the same loading is increased until
\(\boldsymbol{\Omega}\succ 0\) strictly.
Examples
A <- generate_random_network_skeleton(6L, "hub")
W <- assign_iid_signed_weights(A)
build_normalised_precision(W, precision_shift = 0.2)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.6242641 -0.3000000 -0.3000000 0.0000000 0.0000000 0.0000000
#> [2,] -0.3000000 0.6242641 0.0000000 0.0000000 0.0000000 0.0000000
#> [3,] -0.3000000 0.0000000 0.6242641 0.0000000 0.0000000 0.0000000
#> [4,] 0.0000000 0.0000000 0.0000000 0.6242641 0.3000000 0.3000000
#> [5,] 0.0000000 0.0000000 0.0000000 0.3000000 0.6242641 0.0000000
#> [6,] 0.0000000 0.0000000 0.0000000 0.3000000 0.0000000 0.6242641