In this vignette we demonstrate the usage of the jewel method for the estimation of networks. The vignette consists of three parts: generation of the artifical missing values into example dataset (since we need to know the true values for the performance evaluation), application of jewel and performance evaluation (we compare imputed values with the true ones).
First, generate the data: 3 datasets with 100 variables and 50 samples. Their underlying graphs will have a quarter of edges not in common (can be tuned with perc parameter).
K <- 3
p <- 100
n <- 50
data <- generateData_rewire(K = K, p = p, n = n)
G_list_true <- data$Graphs
G_common_true <- data$CommonGraph
X <- data$Data
Method jewel asks for some prior information on hubs if that is available to you. Let’s assume we do know which vertices are hubs. To simulate that, we’ll choose 3% of vertices with the highest degrees and put their degree to 10 (“hub”), while the rest is put to 1. Here we use only one graph because in simulation the degree distribution is the same by construction for all graphs.
true_degrees <- rowSums(G_list_true[[1]])
cut <- sort(true_degrees, decreasing = TRUE)[ceiling(p * 0.03)]
apriori_hubs <- ifelse(true_degrees >= cut, 10, 1)
Now construct the weights.
W <- constructWeights(apriori_hubs, K = K)
And now we estimate the graphs with user chosen λ1 and weights W and with stability selection procedure
res <- jewel(X, lambda1 = 0.1, W = W, stability = TRUE)
G_list_est <- res$G_list
G_common_est <- res$CommonG
evaluatePerformance(G = G_common_true, G_hat = G_common_est)
mapply(evaluatePerformance, G_list_true, G_list_est)
sessionInfo()
#> R version 4.4.2 (2024-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] jewel_2.0.2 rmarkdown_2.29
#>
#> loaded via a namespace (and not attached):
#> [1] vctrs_0.6.5 cli_3.6.3 knitr_1.49 rlang_1.1.4
#> [5] xfun_0.49 purrr_1.0.2 jsonlite_1.8.9 SMUT_1.1
#> [9] buildtools_1.0.0 htmltools_0.5.8.1 maketools_1.3.1 sys_3.4.3
#> [13] sass_0.4.9 matrixcalc_1.0-6 grid_4.4.2 evaluate_1.0.1
#> [17] jquerylib_0.1.4 MASS_7.3-61 fastmap_1.2.0 yaml_2.3.10
#> [21] lifecycle_1.0.4 compiler_4.4.2 igraph_2.1.1 RSpectra_0.16-2
#> [25] pkgconfig_2.0.3 Rcpp_1.0.13-1 lattice_0.22-6 digest_0.6.37
#> [29] R6_2.5.1 parallel_4.4.2 magrittr_2.0.3 bslib_0.8.0
#> [33] Matrix_1.7-1 SPAtest_3.1.2 tools_4.4.2 SKAT_2.2.5
#> [37] cachem_1.1.0