R/rags2ridgesFused.R
GGMpathStats.fused.Rd
A simple wrapper for GGMpathStats
.
GGMpathStats.fused(sparsePlist, ...)
A list
of sparsified precision matrices.
Arguments passed to GGMpathStats
.
A list
of path stats.
The function currently fails if no paths are present in one of the groups.
## Obtain some (high-dimensional) data
set.seed(1)
ns <- c(10, 11)
Slist <- createS(ns, p = 7, topology = "banded")
Tlist <- default.target.fused(Slist, ns)
## Obtain regularized precision and sparsify
Plist <- ridgeP.fused(Slist, ns, Tlist, lambda = c(1, 1.6))
#> i = 1 | max diff = 6.0206645311e-01
#> i = 2 | max diff = 1.6272241569e-01
#> i = 3 | max diff = 4.8213930894e-03
#> i = 4 | max diff = 2.9467129378e-04
#> i = 5 | max diff = 1.9347840638e-05
#> i = 6 | max diff = 1.4191856301e-06
#> i = 7 | max diff = 1.1537054419e-07
#> i = 8 | max diff = 1.0121394755e-08
#> Converged in 8 iterations, max diff < 1.49e-08.
sparsePlist <- sparsify.fused(Plist, threshold = "absValue", absValueCut = 0.20)
#> - Retained elements: 15
#> - Corresponding to 71.43 % of possible edges
#>
#> - Retained elements: 10
#> - Corresponding to 47.62 % of possible edges
#>
SPlist <- lapply(sparsePlist, "[[", "sparsePrecision")
## Obtain information on mediating and moderating paths between nodes 14 and 23
res <- GGMpathStats.fused(SPlist, node1 = 3, node2 = 4, graph = FALSE)
#>
#>
#> ========================================
#> Class: class1
#> Covariance between node pair : -0.79168
#> ----------------------------------------
#> path length contribution
#> 1 3--4 2 1.07541
#> 2 3--1--2--4 1 -1.0261
#> 3 3--1--2--6--4 2 0.78106
#> 4 3--1--2--7--4 2 -0.77765
#> 5 3--2--4 3 -0.76944
#> 6 3--2--6--5--4 3 -0.68468
#> 7 3--2--6--4 3 -0.6788
#> 8 3--2--7--4 3 -0.64249
#> 9 3--5--6--2--4 2 0.63593
#> 10 3--5--4 3 0.53368
#> 11 3--5--6--4 3 0.44948
#> 12 3--5--6--7--4 3 -0.4117
#> 13 3--6--2--4 3 0.37015
#> 14 3--6--5--4 3 -0.31502
#> 15 3--6--4 4 -0.27736
#> 16 3--6--7--4 4 -0.27498
#> 17 3--7--2--4 4 -0.25402
#> 18 3--7--6--5--4 4 0.24596
#> 19 3--7--6--4 4 -0.21394
#> 20 3--7--4 4 -0.17207
#> ----------------------------------------
#> Sum path contributions : -2.40659
#>
#>
#> ========================================
#> Class: class2
#> Covariance between node pair : 0.19206
#> ----------------------------------------
#> path length contribution
#> 1 3--4 2 0.32147
#> 2 3--2--4 1 -0.30642
#> 3 3--2--5--4 2 0.22803
#> 4 3--5--2--4 2 -0.18215
#> 5 3--5--4 3 0.06634
#> 6 3--6--4 3 0.06479
#> ----------------------------------------
#> Sum path contributions : 0.19206