R/glasso+igraphで変数間の関係性を可視化
IrisデータでGraphical Lassoのリハビリ。
library(dplyr)
library(glasso)
library(igraph)
x <- iris %>% select(-Species)
s <- x %>% scale() %>% cov()
fit <- glasso(s = s, rho = 0.5)
a <- ifelse(fit$wi != 0, TRUE, FALSE)
diag(a) <- 0
colnames(a) <- colnames(x)
rownames(a) <- colnames(x)
g <- graph_from_adjacency_matrix(a, mode = "undirected")
plot(g)
Author And Source
この問題について(R/glasso+igraphで変数間の関係性を可視化), 我々は、より多くの情報をここで見つけました https://qiita.com/yono2844/items/a3c63f9116ba30a7b755著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .