boya <- read_excel("/Users/songqingyu/Desktop/Data/Boya1.xlsx")
boya_m <- read_excel("/Users/songqingyu/Desktop/Data/memberlist.xlsx")names(boya) = c("sender","receiver", "content", "month", "day", "time", "memo")
names(boya_m) = c("label", "gender", "leader", "age", "major", "year", "graduate",
"school", "teamtime", "introducer", "race", "provice","urban",
"watch") gender: 女性 = 0, 男性 = 1
leader: 没有担任 = 0, 有担任 = 1
boya_m %>%
mutate(
gender = factor(gender),
leader = factor(leader)
) %>%
select(label, gender, leader) -> boya_m
boya_m## # A tibble: 59 x 3
## label gender leader
## <chr> <fct> <fct>
## 1 Qiu 1 0
## 2 蔡梦彤 0 1
## 3 曹成龙 1 1
## 4 陈家鏖 1 0
## 5 楚芳冰 0 0
## 6 崔健 1 0
## 7 戴悦浩 1 0
## 8 杜航旗 1 0
## 9 段效智 1 1
## 10 段蕴歆 0 0
## # … with 49 more rows
boya_m %>%
group_by(gender) %>%
summarise(n = n())## # A tibble: 2 x 2
## gender n
## <fct> <int>
## 1 0 15
## 2 1 44
boya_m %>%
group_by(gender) %>%
summarise(n = n()) %>%
ggplot(aes(gender, n)) +
geom_bar(stat = "identity", width = 0.4)boya_m %>%
group_by(leader) %>%
summarise(n = n())## # A tibble: 2 x 2
## leader n
## <fct> <int>
## 1 0 51
## 2 1 8
boya_m %>%
group_by(leader) %>%
summarise(n = n()) %>%
ggplot(aes(leader, n)) +
geom_bar(stat = "identity", width = 0.4)sender <- boya %>%
filter(!is.na(sender)) %>%
distinct(sender) %>%
rename(label = sender)
receiver <- boya %>%
filter(!is.na(receiver)) %>%
distinct(receiver) %>%
rename(label = receiver)
nodes <- full_join(sender, receiver, by = "label")
nodes## # A tibble: 59 x 1
## label
## <chr>
## 1 刘圣辰
## 2 宋庆宇
## 3 焦佳升
## 4 肖婷婷
## 5 徐天赐
## 6 曹成龙
## 7 杨江南
## 8 韩特梁
## 9 李宏宇
## 10 段效智
## # … with 49 more rows
nodes <- nodes %>%
rowid_to_column("id")
nodes## # A tibble: 59 x 2
## id label
## <int> <chr>
## 1 1 刘圣辰
## 2 2 宋庆宇
## 3 3 焦佳升
## 4 4 肖婷婷
## 5 5 徐天赐
## 6 6 曹成龙
## 7 7 杨江南
## 8 8 韩特梁
## 9 9 李宏宇
## 10 10 段效智
## # … with 49 more rows
nodes %>%
left_join(boya_m, by = "label") -> nodes
nodes## # A tibble: 59 x 4
## id label gender leader
## <int> <chr> <fct> <fct>
## 1 1 刘圣辰 1 1
## 2 2 宋庆宇 1 0
## 3 3 焦佳升 1 0
## 4 4 肖婷婷 0 1
## 5 5 徐天赐 1 0
## 6 6 曹成龙 1 1
## 7 7 杨江南 1 1
## 8 8 韩特梁 1 0
## 9 9 李宏宇 1 0
## 10 10 段效智 1 1
## # … with 49 more rows
boya %>%
group_by(sender) %>%
summarise(n = n()) %>%
arrange(desc(n))## # A tibble: 60 x 2
## sender n
## <chr> <int>
## 1 杨江南 1405
## 2 刘圣辰 867
## 3 米元博 475
## 4 张敏中 394
## 5 焦佳升 393
## 6 赵康辰 388
## 7 张质源 308
## 8 段效智 298
## 9 吴宜家 203
## 10 曹成龙 189
## # … with 50 more rows
boya %>%
group_by(sender) %>%
summarise(n = n()) %>%
top_n(n = 10) %>%
ggplot() +
geom_bar(aes(x = sender, y =n), stat = "identity")boya %>%
group_by(receiver) %>%
summarise(n = n()) %>%
arrange(desc(n))## # A tibble: 55 x 2
## receiver n
## <chr> <int>
## 1 杨江南 1194
## 2 刘圣辰 829
## 3 <NA> 638
## 4 段效智 618
## 5 赵康辰 476
## 6 张敏中 398
## 7 焦佳升 284
## 8 米元博 266
## 9 张质源 234
## 10 曹成龙 208
## # … with 45 more rows
boya %>%
group_by(receiver) %>%
summarise(n = n()) %>%
top_n(n = 10) %>%
ggplot() +
geom_bar(aes(x = receiver, y =n), stat = "identity") boya %>%
mutate(ind = 1) %>%
group_by(chat_time) %>%
summarise(n_chat = n()) ->boya_chat
boya_chat## # A tibble: 121 x 2
## chat_time n_chat
## <dttm> <int>
## 1 2020-01-26 00:00:00 103
## 2 2020-01-27 00:00:00 7
## 3 2020-01-28 00:00:00 6
## 4 2020-01-29 00:00:00 31
## 5 2020-01-30 00:00:00 96
## 6 2020-01-31 00:00:00 92
## 7 2020-02-01 00:00:00 102
## 8 2020-02-02 00:00:00 27
## 9 2020-02-03 00:00:00 7
## 10 2020-02-04 00:00:00 89
## # … with 111 more rows
ggplot(boya_chat, aes(x= chat_time, y = n_chat)) +
geom_line()m_boya %>%
bind_cols(m_days) %>%
select(1:2, ndays) %>%
mutate(avg_chat = m_chat/ndays) %>%
ggplot() +
geom_bar(aes(x = month...1, y = avg_chat), stat = "identity")boya %>%
filter(!is.na(receiver)) %>%
group_by(sender, receiver) %>%
summarise(weight = n()) %>%
ungroup() -> chat_net## `summarise()` regrouping output by 'sender' (override with `.groups` argument)
chat_net## # A tibble: 789 x 3
## sender receiver weight
## <chr> <chr> <int>
## 1 Qiu 李洋 1
## 2 Qiu 杨江南 2
## 3 伍天一 吴宜家 2
## 4 刘圣辰 刘擎 7
## 5 刘圣辰 刘露阳 1
## 6 刘圣辰 吴双 6
## 7 刘圣辰 吴宜家 21
## 8 刘圣辰 吴昱晨 1
## 9 刘圣辰 吴极 2
## 10 刘圣辰 周普 10
## # … with 779 more rows
chat_net %>%
left_join(nodes, by = c("sender" = "label")) %>%
rename(from = id) %>%
left_join(nodes, by = c("receiver" = "label"))%>%
rename(to = id) %>%
select(from, to, weight) ->edges
edges## # A tibble: 789 x 3
## from to weight
## <int> <int> <int>
## 1 54 16 1
## 2 54 7 2
## 3 56 23 2
## 4 1 24 7
## 5 1 31 1
## 6 1 13 6
## 7 1 23 21
## 8 1 44 1
## 9 1 15 2
## 10 1 37 10
## # … with 779 more rows
boya_net <- graph_from_data_frame(d = edges, vertices = nodes, directed = TRUE)
boya_net## IGRAPH a2856b4 DNW- 59 789 --
## + attr: name (v/c), label (v/c), gender (v/c), leader (v/c), weight
## | (e/n)
## + edges from a2856b4 (vertex names):
## [1] 54->16 54->7 56->23 1 ->24 1 ->31 1 ->13 1 ->23 1 ->44 1 ->15 1 ->37
## [11] 1 ->26 1 ->2 1 ->53 1 ->28 1 ->45 1 ->12 1 ->41 1 ->14 1 ->5 1 ->6
## [21] 1 ->46 1 ->40 1 ->9 1 ->16 1 ->42 1 ->7 1 ->36 1 ->10 1 ->22 1 ->30
## [31] 1 ->57 1 ->3 1 ->39 1 ->27 1 ->17 1 ->49 1 ->34 1 ->38 1 ->19 1 ->4
## [41] 1 ->20 1 ->25 1 ->33 1 ->29 1 ->21 1 ->47 1 ->18 1 ->8 1 ->55 24->1
## [51] 24->23 24->15 24->37 24->12 24->14 24->16 24->7 24->30 24->3 24->29
## [61] 24->21 31->1 31->13 31->23 31->15 31->26 31->45 31->14 31->6 31->35
## + ... omitted several edges
plot(boya_net, vertex.size = 6, layout = layout_with_fr(boya_net),
vertex.label = nodes$id)plot(boya_net, vertex.size = 6, layout = layout_in_circle(boya_net),
vertex.label = nodes$id)plot(boya_net, vertex.size = 6, layout = layout_with_kk(boya_net),
vertex.label = nodes$id)plot(boya_net, vertex.size = 6, layout = layout_with_lgl,
vertex.label = nodes$id)heatmap(boya_netm[, 59:1], Rowv = NA, col = palf(100),
scale = "none", margins = c(10, 10))par(mfrow = c(2, 3))
plot(net_igraph_1, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)
plot(net_igraph_2, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)
plot(net_igraph_3, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)
plot(net_igraph_4, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)
plot(net_igraph_5, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)
plot(net_igraph_6, vertex.size = 6, layout = layout_in_circle,
vertex.label = nodes$id)ecount(boya_net)/(vcount(boya_net) *(vcount(boya_net) - 1))## [1] 0.2305669
reciprocity(boya_net)## [1] 0.6988564
dyad_census(boya_net)## $mut
## [1] 276
##
## $asym
## [1] 237
##
## $null
## [1] 1198
2*dyad_census(boya_net)$mut/ecount(boya_net)## [1] 0.6996198
transitivity(boya_net, type = "global") #作为无向网的传递性## [1] 0.5476739
transitivity(boya_net, type = "local")## [1] 0.09814688 0.41846154 0.18234950 0.22415459 0.21746881 0.21019608
## [7] 0.10033595 0.35507246 0.41904762 0.19209040 0.53846154 0.17715618
## [13] 0.31092437 0.23215686 0.22901849 0.21727395 0.25825826 0.44871795
## [19] 0.18032787 0.46323529 0.16461809 0.42153846 0.20965309 0.31225296
## [25] 0.36333333 0.28623188 0.43448276 0.43157895 0.25913621 0.37154150
## [31] 0.26507937 0.83333333 0.21652422 0.21428571 0.37500000 0.44444444
## [37] 0.30303030 0.49090909 0.41538462 0.40000000 0.50000000 0.37362637
## [43] NaN 0.66666667 0.23076923 0.46666667 0.35483871 0.90000000
## [49] 0.35789474 1.00000000 0.28888889 0.33333333 0.34848485 0.16666667
## [55] 0.33333333 NaN 0.34761905 0.00000000 NaN
triad_census(boya_net) #有向网## [1] 13973 5602 4664 308 732 390 1492 994 157 16 1976 234
## [13] 140 152 990 689
diameter(boya_net, directed = F, weights = NA)## [1] 3
diameter(boya_net, directed = F)## [1] 5
diam <- get_diameter(boya_net, directed = T)
diam## + 6/59 vertices, named, from a2856b4:
## [1] 58 14 20 1 42 36
class(diam)## [1] "igraph.vs"
as.vector(diam)## [1] 58 14 20 1 42 36
vcol <- rep("gray80", vcount(boya_net))
vcol[diam] <- "red"
ecol <- rep("gray80", ecount(boya_net))
ecol[E(boya_net, path = diam)] <- "red"
plot(boya_net, vertex.col = vcol, edge.color = ecol, edge.arrow.mode = 0,
vertex.label = NA)deg <- igraph::degree(boya_net, mode = "all")
deg## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 94 26 59 46 34 51 95 24 15 60 14 66 35 51 38 39 37 13 62 17 68 26 52 23 25 24
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 30 20 43 23 36 9 27 8 16 9 33 11 26 6 16 14 1 7 13 10 32 5 20 2 10 13
## 53 54 55 56 57 58 59
## 12 4 3 1 21 2 1
hist(deg)###出度
deg_out <- igraph::degree(boya_net, mode = "out")
deg_out## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 46 14 29 22 16 22 47 13 7 19 11 32 22 28 15 20 23 8 35 8 33 19 22 12 12 12
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 21 14 13 5 20 9 13 4 9 7 17 6 9 4 9 10 1 3 8 6 9 3 9 2 5 9
## 53 54 55 56 57 58 59
## 6 2 1 1 5 1 1
hist(deg_out)###入度
deg_in <- igraph::degree(boya_net, mode = "in")
deg_in## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 48 12 30 24 18 29 48 11 8 41 3 34 13 23 23 19 14 5 27 9 35 7 30 11 13 12
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 9 6 30 18 16 0 14 4 7 2 16 5 17 2 7 4 0 4 5 4 23 2 11 0 5 4
## 53 54 55 56 57 58 59
## 6 2 2 0 16 1 0
hist(deg_in)deg_boya <- degree_distribution(boya_net, cumulative = T, mode = "all")
plot(x = 0:max(deg), y = 1- deg_boya, pch = 19,
cex = 1.2, col = "red",
xlab = "Degree", ylab = "Cumulative Frequency")deg_boya_out <- degree_distribution(boya_net, cumulative = T, mode = "out")
plot(x = 0:max(deg_out), y = 1- deg_boya_out, pch = 19,
cex = 1.2, col = "red",
xlab = "Out-Degree", ylab = "Cumulative Frequency")deg_boya_in <- degree_distribution(boya_net, cumulative = T, mode = "in")
plot(x = 0:max(deg_in), y = 1- deg_boya_in, pch = 19,
cex = 1.2, col = "red",
xlab = "In-Degree", ylab = "Cumulative Frequency")igraph::degree(boya_net, mode = "in")## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 48 12 30 24 18 29 48 11 8 41 3 34 13 23 23 19 14 5 27 9 35 7 30 11 13 12
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 9 6 30 18 16 0 14 4 7 2 16 5 17 2 7 4 0 4 5 4 23 2 11 0 5 4
## 53 54 55 56 57 58 59
## 6 2 2 0 16 1 0
centr_degree(boya_net, mode = "in", normalized = T)## $res
## [1] 48 12 30 24 18 29 48 11 8 41 3 34 13 23 23 19 14 5 27 9 35 7 30 11 13
## [26] 12 9 6 30 18 16 0 14 4 7 2 16 5 17 2 7 4 0 4 5 4 23 2 11 0
## [51] 5 4 6 2 2 0 16 1 0
##
## $centralization
## [1] 0.5970193
##
## $theoretical_max
## [1] 3422
igraph::degree(boya_net, mode = "out")## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 46 14 29 22 16 22 47 13 7 19 11 32 22 28 15 20 23 8 35 8 33 19 22 12 12 12
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 21 14 13 5 20 9 13 4 9 7 17 6 9 4 9 10 1 3 8 6 9 3 9 2 5 9
## 53 54 55 56 57 58 59
## 6 2 1 1 5 1 1
centr_degree(boya_net, mode = "out", normalized = T)## $res
## [1] 46 14 29 22 16 22 47 13 7 19 11 32 22 28 15 20 23 8 35 8 33 19 22 12 12
## [26] 12 21 14 13 5 20 9 13 4 9 7 17 6 9 4 9 10 1 3 8 6 9 3 9 2
## [51] 5 9 6 2 1 1 5 1 1
##
## $centralization
## [1] 0.5797779
##
## $theoretical_max
## [1] 3422
igraph::closeness(boya_net, mode = "all", weights = NA)## 1 2 3 4 5 6
## 0.015151515 0.010204082 0.012195122 0.011111111 0.010204082 0.011764706
## 7 8 9 10 11 12
## 0.015384615 0.009900990 0.009345794 0.013513514 0.009433962 0.013157895
## 13 14 15 16 17 18
## 0.010869565 0.012048193 0.010869565 0.010752688 0.010752688 0.009259259
## 19 20 21 22 23 24
## 0.012820513 0.009615385 0.013157895 0.010416667 0.012048193 0.009708738
## 25 26 27 28 29 30
## 0.010101010 0.009708738 0.010752688 0.009803922 0.011627907 0.009803922
## 31 32 33 34 35 36
## 0.010752688 0.009174312 0.009900990 0.008620690 0.009345794 0.009009009
## 37 38 39 40 41 42
## 0.010638298 0.009174312 0.010416667 0.008695652 0.009523810 0.009259259
## 43 44 45 46 47 48
## 0.007633588 0.008928571 0.008928571 0.008849558 0.010989011 0.008695652
## 49 50 51 52 53 54
## 0.009433962 0.008196721 0.008620690 0.009090909 0.009009009 0.008264463
## 55 56 57 58 59
## 0.008264463 0.007142857 0.009803922 0.007142857 0.007633588
centr_clo(boya_net, mode = "all", normalized = T)## $res
## [1] 0.8787879 0.5918367 0.7073171 0.6444444 0.5918367 0.6823529 0.8923077
## [8] 0.5742574 0.5420561 0.7837838 0.5471698 0.7631579 0.6304348 0.6987952
## [15] 0.6304348 0.6236559 0.6236559 0.5370370 0.7435897 0.5576923 0.7631579
## [22] 0.6041667 0.6987952 0.5631068 0.5858586 0.5631068 0.6236559 0.5686275
## [29] 0.6744186 0.5686275 0.6236559 0.5321101 0.5742574 0.5000000 0.5420561
## [36] 0.5225225 0.6170213 0.5321101 0.6041667 0.5043478 0.5523810 0.5370370
## [43] 0.4427481 0.5178571 0.5178571 0.5132743 0.6373626 0.5043478 0.5471698
## [50] 0.4754098 0.5000000 0.5272727 0.5225225 0.4793388 0.4793388 0.4142857
## [57] 0.5686275 0.4142857 0.4427481
##
## $centralization
## [1] 0.6275924
##
## $theoretical_max
## [1] 28.74783
igraph::closeness(boya_net, mode = "out", weights = NA)## Warning in igraph::closeness(boya_net, mode = "out", weights = NA): At
## centrality.c:2784 :closeness centrality is not well-defined for disconnected
## graphs
## 1 2 3 4 5 6
## 0.002816901 0.002583979 0.002688172 0.002638522 0.002590674 0.002631579
## 7 8 9 10 11 12
## 0.002824859 0.002570694 0.002525253 0.002617801 0.002551020 0.002710027
## 13 14 15 16 17 18
## 0.002631579 0.002680965 0.002583979 0.002624672 0.002638522 0.002531646
## 19 20 21 22 23 24
## 0.002732240 0.002531646 0.002717391 0.002617801 0.002638522 0.002570694
## 25 26 27 28 29 30
## 0.002557545 0.002557545 0.002631579 0.002577320 0.002564103 0.002512563
## 31 32 33 34 35 36
## 0.002617801 0.002967359 0.002570694 0.002506266 0.002493766 0.002531646
## 37 38 39 40 41 42
## 0.002590674 0.002518892 0.002538071 0.002506266 0.002538071 0.002544529
## 43 44 45 46 47 48
## 0.002652520 0.002469136 0.002531646 0.002500000 0.002538071 0.002475248
## 49 50 51 52 53 54
## 0.002538071 0.002865330 0.002500000 0.002525253 0.002525253 0.002469136
## 55 56 57 58 59
## 0.002314815 0.002673797 0.002493766 0.002352941 0.002652520
centr_clo(boya_net, mode = "out", normalized = T)## Warning in centr_clo(boya_net, mode = "out", normalized = T): At centrality.c:
## 2784 :closeness centrality is not well-defined for disconnected graphs
## $res
## [1] 0.1633803 0.1498708 0.1559140 0.1530343 0.1502591 0.1526316 0.1638418
## [8] 0.1491003 0.1464646 0.1518325 0.1479592 0.1571816 0.1526316 0.1554960
## [15] 0.1498708 0.1522310 0.1530343 0.1468354 0.1584699 0.1468354 0.1576087
## [22] 0.1518325 0.1530343 0.1491003 0.1483376 0.1483376 0.1526316 0.1494845
## [29] 0.1487179 0.1457286 0.1518325 0.1721068 0.1491003 0.1453634 0.1446384
## [36] 0.1468354 0.1502591 0.1460957 0.1472081 0.1453634 0.1472081 0.1475827
## [43] 0.1538462 0.1432099 0.1468354 0.1450000 0.1472081 0.1435644 0.1472081
## [50] 0.1661891 0.1450000 0.1464646 0.1464646 0.1432099 0.1342593 0.1550802
## [57] 0.1446384 0.1364706 0.1538462
##
## $centralization
## [1] 0.02280946
##
## $theoretical_max
## [1] 57.01695
igraph::closeness(boya_net, mode = "in", weights = NA)## Warning in igraph::closeness(boya_net, mode = "in", weights = NA): At
## centrality.c:2784 :closeness centrality is not well-defined for disconnected
## graphs
## 1 2 3 4 5 6
## 0.0147058824 0.0093457944 0.0116279070 0.0106382979 0.0101010101 0.0114942529
## 7 8 9 10 11 12
## 0.0147058824 0.0094339623 0.0090909091 0.0133333333 0.0082644628 0.0121951220
## 13 14 15 16 17 18
## 0.0093457944 0.0107526882 0.0106382979 0.0099009901 0.0096153846 0.0086206897
## 19 20 21 22 23 24
## 0.0109890110 0.0090909091 0.0123456790 0.0090090090 0.0116279070 0.0091743119
## 25 26 27 28 29 30
## 0.0094339623 0.0095238095 0.0090090090 0.0088495575 0.0114942529 0.0098039216
## 31 32 33 34 35 36
## 0.0098039216 0.0002922268 0.0096153846 0.0084745763 0.0086206897 0.0080645161
## 37 38 39 40 41 42
## 0.0095238095 0.0086206897 0.0098039216 0.0083333333 0.0087719298 0.0084745763
## 43 44 45 46 47 48
## 0.0002922268 0.0084745763 0.0086206897 0.0085470085 0.0106382979 0.0065359477
## 49 50 51 52 53 54
## 0.0092592593 0.0002922268 0.0083333333 0.0081967213 0.0085470085 0.0080645161
## 55 56 57 58 59
## 0.0081967213 0.0002922268 0.0097087379 0.0066666667 0.0002922268
centr_clo(boya_net, mode = "in", normalized = T)## Warning in centr_clo(boya_net, mode = "in", normalized = T): At centrality.c:
## 2784 :closeness centrality is not well-defined for disconnected graphs
## $res
## [1] 0.85294118 0.54205607 0.67441860 0.61702128 0.58585859 0.66666667
## [7] 0.85294118 0.54716981 0.52727273 0.77333333 0.47933884 0.70731707
## [13] 0.54205607 0.62365591 0.61702128 0.57425743 0.55769231 0.50000000
## [19] 0.63736264 0.52727273 0.71604938 0.52252252 0.67441860 0.53211009
## [25] 0.54716981 0.55238095 0.52252252 0.51327434 0.66666667 0.56862745
## [31] 0.56862745 0.01694915 0.55769231 0.49152542 0.50000000 0.46774194
## [37] 0.55238095 0.50000000 0.56862745 0.48333333 0.50877193 0.49152542
## [43] 0.01694915 0.49152542 0.50000000 0.49572650 0.61702128 0.37908497
## [49] 0.53703704 0.01694915 0.48333333 0.47540984 0.49572650 0.46774194
## [55] 0.47540984 0.01694915 0.56310680 0.38666667 0.01694915
##
## $centralization
## [1] 0.3500603
##
## $theoretical_max
## [1] 57.01695
eigen_centrality(boya_net, directed = T, weights = NA)## $vector
## 1 2 3 4 5 6 7
## 0.98237312 0.39686760 0.78870966 0.68628396 0.54049071 0.76654865 1.00000000
## 8 9 10 11 12 13 14
## 0.40419605 0.32677348 0.85671481 0.11723080 0.81841831 0.36836393 0.66453628
## 15 16 17 18 19 20 21
## 0.62049181 0.51449371 0.48320943 0.19712985 0.65187346 0.33317371 0.82701243
## 22 23 24 25 26 27 28
## 0.27780935 0.74242765 0.36281153 0.39037644 0.40222927 0.29796937 0.23258505
## 29 30 31 32 33 34 35
## 0.74438225 0.48008591 0.47506260 0.00000000 0.43084925 0.14658023 0.22949252
## 36 37 38 39 40 41 42
## 0.05634572 0.44169808 0.18348571 0.46116003 0.09925030 0.26867419 0.14304659
## 43 44 45 46 47 48 49
## 0.00000000 0.15264708 0.16129690 0.17458534 0.55783541 0.03602315 0.36585993
## 50 51 52 53 54 55 56
## 0.00000000 0.14562940 0.11235000 0.17380608 0.07582526 0.06762655 0.00000000
## 57 58 59
## 0.39914771 0.03327094 0.00000000
##
## $value
## [1] 19.97347
##
## $options
## $options$bmat
## [1] "I"
##
## $options$n
## [1] 59
##
## $options$which
## [1] "LR"
##
## $options$nev
## [1] 1
##
## $options$tol
## [1] 0
##
## $options$ncv
## [1] 0
##
## $options$ldv
## [1] 0
##
## $options$ishift
## [1] 1
##
## $options$maxiter
## [1] 1000
##
## $options$nb
## [1] 1
##
## $options$mode
## [1] 1
##
## $options$start
## [1] 1
##
## $options$sigma
## [1] 0
##
## $options$sigmai
## [1] 0
##
## $options$info
## [1] 0
##
## $options$iter
## [1] 1
##
## $options$nconv
## [1] 1
##
## $options$numop
## [1] 20
##
## $options$numopb
## [1] 0
##
## $options$numreo
## [1] 11
centr_eigen(boya_net, directed = T, normalized = T)## $vector
## [1] 0.98237312 0.39686760 0.78870966 0.68628396 0.54049071 0.76654865
## [7] 1.00000000 0.40419605 0.32677348 0.85671481 0.11723080 0.81841831
## [13] 0.36836393 0.66453628 0.62049181 0.51449371 0.48320943 0.19712985
## [19] 0.65187346 0.33317371 0.82701243 0.27780935 0.74242765 0.36281153
## [25] 0.39037644 0.40222927 0.29796937 0.23258505 0.74438225 0.48008591
## [31] 0.47506260 0.00000000 0.43084925 0.14658023 0.22949252 0.05634572
## [37] 0.44169808 0.18348571 0.46116003 0.09925030 0.26867419 0.14304659
## [43] 0.00000000 0.15264708 0.16129690 0.17458534 0.55783541 0.03602315
## [49] 0.36585993 0.00000000 0.14562940 0.11235000 0.17380608 0.07582526
## [55] 0.06762655 0.00000000 0.39914771 0.03327094 0.00000000
##
## $value
## [1] 19.97347
##
## $options
## $options$bmat
## [1] "I"
##
## $options$n
## [1] 59
##
## $options$which
## [1] "LR"
##
## $options$nev
## [1] 1
##
## $options$tol
## [1] 0
##
## $options$ncv
## [1] 0
##
## $options$ldv
## [1] 0
##
## $options$ishift
## [1] 1
##
## $options$maxiter
## [1] 1000
##
## $options$nb
## [1] 1
##
## $options$mode
## [1] 1
##
## $options$start
## [1] 1
##
## $options$sigma
## [1] 0
##
## $options$sigmai
## [1] 0
##
## $options$info
## [1] 0
##
## $options$iter
## [1] 1
##
## $options$nconv
## [1] 1
##
## $options$numop
## [1] 20
##
## $options$numopb
## [1] 0
##
## $options$numreo
## [1] 11
##
##
## $centralization
## [1] 0.6436704
##
## $theoretical_max
## [1] 58
igraph::betweenness(boya_net, directed = T, weights = NA)## 1 2 3 4 5 6
## 579.21762588 2.41663377 73.99430129 52.57194155 20.60532032 57.25808611
## 7 8 9 10 11 12
## 566.81383490 2.59993705 0.21428571 188.39636712 0.18181818 138.92956807
## 13 14 15 16 17 18
## 68.51926661 145.78103757 29.84027802 48.17343376 16.33880083 1.44077858
## 19 20 21 22 23 24
## 128.13395260 0.41899767 153.92643446 30.83280599 112.66719734 5.29082029
## 25 26 27 28 29 30
## 11.92616055 3.47928640 8.94243105 3.04055944 21.66558611 2.53483750
## 31 32 33 34 35 36
## 28.44587219 0.00000000 20.69523064 0.00000000 1.99257497 0.55833333
## 37 38 39 40 41 42
## 41.85326887 0.25000000 6.74612512 0.00000000 0.16783217 3.11190476
## 43 44 45 46 47 48
## 0.00000000 0.06666667 2.90721125 0.05263158 8.88614153 0.06666667
## 49 50 51 52 53 54
## 2.50200345 0.00000000 1.09081197 1.85430403 1.21313131 0.00000000
## 55 56 57 58 59
## 0.00000000 0.00000000 2.38690476 0.00000000 0.00000000
edge_betweenness(boya_net, directed = T, weights = NA)## [1] 12.277778 40.722222 54.000000 11.698413 9.954599 12.060714 4.833405
## [8] 21.310345 6.701810 14.397825 9.749206 10.678175 24.906280 14.616667
## [15] 23.387431 3.806118 13.728571 12.253878 8.007619 4.724351 18.833333
## [22] 29.000000 10.398810 10.469827 21.346154 6.055320 55.114286 3.147655
## [29] 16.485126 9.036769 10.633308 4.856349 9.376371 14.176984 8.129748
## [36] 12.403211 23.916667 21.322222 7.622748 6.319488 12.716270 11.816699
## [43] 9.424939 4.591642 5.345521 6.065873 17.900000 9.140945 49.755952
## [50] 11.327489 3.206926 2.389394 3.720285 4.625108 5.821812 3.384271
## [57] 10.151299 1.867483 3.925108 2.253680 5.617965 8.034434 3.497987
## [64] 2.840447 2.444173 2.556382 6.132479 4.918164 2.334892 4.428575
## [71] 4.243344 7.133640 2.486418 2.214268 3.728044 7.391622 4.236876
## [78] 2.437034 3.990783 2.919416 3.476894 13.970249 4.478680 5.116378
## [85] 3.167338 3.192857 6.395684 6.468803 4.087587 3.113564 15.938503
## [92] 3.576862 2.582418 5.620544 3.219481 8.684871 4.684449 4.364957
## [99] 2.514103 6.656550 2.394444 3.046898 8.244048 15.283774 6.670707
## [106] 7.493398 5.126825 9.728838 6.769826 9.673954 5.457620 5.905952
## [113] 7.496487 13.377994 4.698990 5.740451 5.821248 4.890657 8.172367
## [120] 10.905556 8.983305 6.740992 6.532937 3.436916 6.758404 37.791667
## [127] 10.690476 4.584524 10.495585 4.352392 4.467107 7.024095 3.900347
## [134] 3.222763 9.774950 3.081000 3.224864 4.574217 4.004149 10.565865
## [141] 6.349217 4.751274 3.052453 8.954401 2.544877 4.285354 2.849639
## [148] 0.000000 4.075830 3.025505 9.037734 2.617100 2.263070 3.546068
## [155] 3.861122 3.212277 1.942063 4.736544 33.233827 4.667857 10.284921
## [162] 3.522258 4.934220 2.615415 3.040873 10.284921 2.969048 2.322161
## [169] 3.244719 1.973449 6.130159 5.157143 13.839286 3.197619 6.505952
## [176] 13.839286 3.588095 1.375000 2.479762 7.764286 1.410714 9.238431
## [183] 3.117796 2.967399 3.763326 3.917002 4.169383 2.643193 10.738431
## [190] 2.231746 3.586050 1.444780 4.663431 1.226923 1.708741 14.466667
## [197] 7.500000 4.774242 15.300000 9.194444 2.977778 9.412734 2.512734
## [204] 3.399242 4.236544 3.594877 9.046068 2.628211 1.801166 3.721068
## [211] 1.833838 5.802020 1.884524 4.783766 1.383766 15.996825 4.835714
## [218] 15.202381 2.502510 3.226190 8.585714 3.272161 2.285714 54.000000
## [225] 5.038356 6.456746 6.230299 7.593290 3.363564 3.941457 8.164516
## [232] 5.886147 5.831349 8.078571 7.811361 4.674254 3.192829 11.500000
## [239] 6.346429 6.151177 14.450549 6.304830 2.738131 10.443485 4.693912
## [246] 5.522594 3.507937 5.456926 5.480802 5.880512 3.977764 6.225336
## [253] 3.289719 3.881575 3.874206 5.940945 13.330952 3.872619 14.080952
## [260] 3.886905 1.510689 5.472619 1.902381 2.138095 6.972619 13.196581
## [267] 5.214114 3.838406 3.779733 3.999206 4.064683 5.153096 3.689608
## [274] 58.000000 2.956177 7.507972 12.563248 2.896465 8.955639 4.646007
## [281] 4.341026 4.023990 4.217721 4.693687 6.961783 4.389810 4.701068
## [288] 4.603175 5.836996 2.439261 5.432546 2.991667 3.687374 9.309077
## [295] 4.537155 4.869333 2.814629 2.698016 3.867716 2.587191 5.748149
## [302] 4.353207 8.530505 2.032057 6.577784 3.781197 4.028771 3.153185
## [309] 4.717349 53.000000 54.000000 7.989172 5.016075 3.535086 3.158066
## [316] 5.134617 11.767391 3.842385 6.154863 3.723286 5.919656 7.963111
## [323] 2.273145 3.825658 3.827073 5.550830 5.927546 4.072420 4.918022
## [330] 2.942471 4.822299 3.345635 4.549278 20.313165 9.766246 6.305742
## [337] 3.443838 11.260055 1.963585 6.354217 5.669891 5.197434 5.488049
## [344] 6.323157 2.439590 6.935495 4.044494 12.540248 20.150000 7.450000
## [351] 21.650000 3.750000 13.961905 4.686905 3.195238 6.878571 4.478571
## [358] 14.961905 5.051190 11.907143 9.256421 3.188131 3.258405 3.014848
## [365] 4.854001 4.040642 6.387216 3.411555 3.374315 6.150866 2.885750
## [372] 3.421104 8.408009 6.268519 5.851227 4.311219 3.384560 3.186086
## [379] 4.613418 10.755952 2.854762 5.698810 11.755952 3.444048 3.529762
## [386] 1.575000 7.705952 7.005952 1.785714 46.092857 5.070859 9.731746
## [393] 8.635390 12.661905 4.644517 22.310345 5.282633 12.833539 9.999206
## [400] 10.428175 14.450000 20.583333 3.964451 13.145238 11.070513 7.074254
## [407] 4.962273 19.833333 21.008888 29.000000 10.648810 6.768637 23.089011
## [414] 3.397655 17.554174 8.536769 10.299975 4.348016 8.637482 28.256224
## [421] 12.510317 30.136905 8.751004 33.726190 11.903211 22.416667 5.401018
## [428] 5.702789 10.882937 11.037923 7.873352 5.017832 4.372076 6.982540
## [435] 18.387923 10.390945 15.326190 4.676190 2.226190 17.326190 4.909524
## [442] 1.642857 7.451190 34.165446 19.834554 25.343026 9.673990 9.404603
## [449] 10.099206 14.120346 11.119688 16.433016 8.886648 8.148918 10.296429
## [456] 27.299108 20.019717 10.009988 11.974986 11.885389 6.198785 14.605360
## [463] 6.270635 9.606530 8.125794 3.159163 2.892063 3.103448 2.621825
## [470] 1.890079 3.653449 2.178175 8.409127 2.237302 1.768864 1.877381
## [477] 2.955159 1.960029 5.328175 1.599206 3.836759 1.403968 24.832839
## [484] 17.487759 4.482633 9.203237 5.857576 18.503632 6.557022 10.442961
## [491] 21.148965 6.874707 10.363251 5.919877 4.765079 4.747691 2.223124
## [498] 11.342529 2.895331 5.863734 4.401984 7.074242 2.681551 6.469481
## [505] 4.918565 3.483777 2.384271 4.932143 4.275780 5.079401 1.455988
## [512] 3.243912 3.676371 3.987721 4.145238 3.536122 4.932937 5.225433
## [519] 4.330495 1.939261 2.997509 4.064755 12.411905 3.672712 12.578571
## [526] 3.786905 4.377778 7.696429 5.600397 7.128571 2.492857 4.651190
## [533] 4.576190 24.869048 14.752381 5.242002 7.938752 1.843651 3.510058
## [540] 1.969048 2.789018 2.011905 3.951227 2.171725 3.115115 7.060750
## [547] 2.179004 1.691281 1.219780 2.667893 1.816306 2.459856 4.465340
## [554] 2.853175 1.613034 2.889322 1.726190 10.475000 3.038095 4.948810
## [561] 3.128571 9.775000 3.143651 1.290909 4.115476 1.644877 6.432143
## [568] 5.189286 7.373088 2.240783 1.973939 1.768290 2.466071 4.751691
## [575] 3.130664 3.424355 2.226822 1.650505 7.623088 1.847024 2.028327
## [582] 1.878546 2.642731 3.381981 2.548882 4.103445 2.916108 2.659560
## [589] 2.149206 1.433333 3.120362 5.756349 3.461111 2.387302 4.220635
## [596] 4.837302 17.506349 4.389683 8.971825 3.323748 11.348810 3.602056
## [603] 1.969048 4.169048 5.924300 11.098810 6.736905 4.551587 6.101441
## [610] 21.500000 6.666667 21.000000 3.833333 17.533333 5.741667 19.533333
## [617] 5.300000 2.016667 3.125000 5.718504 4.694383 3.614261 6.042832
## [624] 2.533308 2.497255 7.532227 4.323748 4.527814 11.039614 6.610256
## [631] 8.416667 3.135697 6.322161 5.551104 3.406335 2.527764 5.422619
## [638] 4.626079 4.390726 1.995213 2.762612 3.440152 10.374591 5.747497
## [645] 4.113356 13.985653 4.738925 8.988889 3.478150 4.901984 5.054304
## [652] 2.750408 2.948626 2.920238 7.619792 4.713779 3.309450 3.393044
## [659] 3.384946 5.109017 2.348735 7.885965 6.627732 4.263095 5.367433
## [666] 8.332584 8.796880 2.863020 3.778817 4.274840 4.130085 4.077235
## [673] 2.053400 2.367711 7.208187 3.666196 12.173810 6.223810 4.277656
## [680] 12.340476 3.747619 5.040476 2.074675 7.540476 11.071129 3.582272
## [687] 3.983421 5.904407 3.745703 11.587002 3.336544 2.796800 5.066662
## [694] 4.698052 3.451501 5.702668 12.449206 5.280649 5.636905 3.260714
## [701] 3.842857 4.154279 10.645238 3.385714 2.655012 4.953571 8.916270
## [708] 5.398148 3.116667 9.823160 3.726299 7.597330 10.420079 3.214430
## [715] 5.023124 5.662360 7.943852 5.019131 5.863131 0.000000 5.575359
## [722] 4.797330 6.177795 5.302604 6.776623 2.668383 9.507013 5.263492
## [729] 5.831782 3.022090 8.411905 6.575007 4.560855 3.141371 10.925555
## [736] 5.902593 5.579252 2.200166 4.928926 4.924975 3.358819 5.574083
## [743] 7.143651 19.636905 4.561415 6.903211 12.655556 4.946443 3.469188
## [750] 7.706746 5.985635 6.250071 2.508308 3.249206 11.276812 11.880952
## [757] 5.225433 6.601623 4.888528 14.343347 3.493651 5.653114 2.654004
## [764] 7.145489 32.919088 11.224911 8.922668 14.983333 2.764734 16.316667
## [771] 4.638889 2.726190 2.483333 8.702632 1.825000 9.982973 3.623052
## [778] 3.153211 4.313925 2.857215 11.482973 2.533766 4.090115 2.417172
## [785] 3.471800 1.350000 5.041160 1.282576 53.000000
centr_betw(boya_net, directed = T, normalized = T)## $res
## [1] 579.21762588 2.41663377 73.99430129 52.57194155 20.60532032
## [6] 57.25808611 566.81383490 2.59993705 0.21428571 188.39636712
## [11] 0.18181818 138.92956807 68.51926661 145.78103757 29.84027802
## [16] 48.17343376 16.33880083 1.44077858 128.13395260 0.41899767
## [21] 153.92643446 30.83280599 112.66719734 5.29082029 11.92616055
## [26] 3.47928640 8.94243105 3.04055944 21.66558611 2.53483750
## [31] 28.44587219 0.00000000 20.69523064 0.00000000 1.99257497
## [36] 0.55833333 41.85326887 0.25000000 6.74612512 0.00000000
## [41] 0.16783217 3.11190476 0.00000000 0.06666667 2.90721125
## [46] 0.05263158 8.88614153 0.06666667 2.50200345 0.00000000
## [51] 1.09081197 1.85430403 1.21313131 0.00000000 0.00000000
## [56] 0.00000000 2.38690476 0.00000000 0.00000000
##
## $centralization
## [1] 0.164658
##
## $theoretical_max
## [1] 191748
boya_hs <- hub_score(boya_net, weights = NA)$vector
boya_hs## 1 2 3 4 5 6 7
## 0.99171100 0.50242645 0.79917006 0.58483567 0.47890400 0.68997878 1.00000000
## 8 9 10 11 12 13 14
## 0.47801057 0.27641072 0.56900201 0.41493441 0.86225164 0.68603380 0.78333844
## 15 16 17 18 19 20 21
## 0.49217702 0.59024894 0.70221403 0.28353118 0.87321113 0.30971531 0.85676283
## 22 23 24 25 26 27 28
## 0.55876834 0.66222151 0.43470406 0.37523912 0.41233109 0.68875583 0.50358151
## 29 30 31 32 33 34 35
## 0.46179919 0.20610615 0.57847738 0.34734856 0.41522975 0.14531046 0.27146331
## 36 37 38 39 40 41 42
## 0.24177187 0.53167086 0.24567275 0.32142572 0.17544179 0.35057010 0.34591592
## 43 44 45 46 47 48 49
## 0.04559290 0.12484165 0.23808947 0.23276949 0.37325581 0.13230765 0.30261253
## 50 51 52 53 54 55 56
## 0.08988250 0.14970146 0.28813920 0.22226414 0.07575882 0.01825629 0.03742776
## 57 58 59
## 0.18391434 0.03244959 0.04559290
boya_as <- authority_score(boya_net, weights = NA)$vector
boya_as## 1 2 3 4 5 6
## 9.950399e-01 4.302715e-01 8.008970e-01 6.575407e-01 5.367871e-01 7.392671e-01
## 7 8 9 10 11 12
## 1.000000e+00 3.594835e-01 2.874946e-01 9.118645e-01 1.109205e-01 8.026226e-01
## 13 14 15 16 17 18
## 3.651284e-01 6.489964e-01 5.852222e-01 5.151871e-01 4.413823e-01 1.797285e-01
## 19 20 21 22 23 24
## 6.759737e-01 3.290375e-01 8.450132e-01 2.388856e-01 7.485604e-01 3.368517e-01
## 25 26 27 28 29 30
## 3.860367e-01 3.936603e-01 2.821163e-01 2.055989e-01 7.652599e-01 5.108231e-01
## 31 32 33 34 35 36
## 4.768433e-01 4.877701e-17 3.960025e-01 1.358595e-01 2.111223e-01 6.063325e-02
## 37 38 39 40 41 42
## 4.765202e-01 1.679589e-01 4.927646e-01 9.028221e-02 2.752313e-01 1.403265e-01
## 43 44 45 46 47 48
## 1.524282e-18 1.518362e-01 1.691468e-01 1.558772e-01 5.899460e-01 4.942849e-02
## 49 50 51 52 53 54
## 3.698343e-01 3.048563e-18 1.442348e-01 1.145250e-01 1.775031e-01 7.208435e-02
## 55 56 57 58 59
## 7.605045e-02 1.524282e-18 4.520514e-01 3.550793e-02 1.524282e-18
par(mfrow = c(1, 2))
plot(boya_net, vertex.size = boya_hs * 10, mian = "Hubs", vertex.label = NA)
plot(boya_net, vertex.size = boya_as * 10, main = "Authorities", vertex.label = NA)mean_distance(boya_net, directed = T)## [1] 1.83046
distances(boya_net, weights = NA)## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
## 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 2 1 0 1 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 1 1 1 2 2 2 1 2
## 3 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1
## 4 1 2 1 0 2 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 1 2
## 5 1 2 1 2 0 1 1 2 2 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 2 1 2 2
## 6 1 1 1 1 1 0 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 2 1 2 2 1 1 2
## 7 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## 8 1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 2 3 3 3 3 3 2 2 2 2 2 3 3 3 3 3 2 3 3 3 3 2 3
## 57 2 2 2 1 2 2 2 2 1 2 2 2 1 1 3 2 2 2 2 2 2 2 2 2 2
## 58 2 3 2 3 2 3 2 3 3 3 2 3 3 3 3 3 3 3 2 3 2 3 3 3 2
## 59 2 3 2 2 2 3 2 2 2 2 2 3 2 2 2 2 3 3 2 2 3 3 3 2 3
## 54 55 56 57 58 59
## 1 2 1 2 1 2 2
## 2 2 2 2 2 2 2
## 3 2 2 2 2 2 2
## 4 2 2 2 2 2 3
## 5 2 2 3 2 2 2
## 6 2 2 2 2 2 2
## 7 1 2 2 1 2 2
## 8 2 2 2 2 2 2
## 9 2 2 2 2 3 2
## 10 2 2 2 2 2 1
## 11 2 2 2 2 3 2
## 12 2 2 2 1 2 2
## 13 2 1 2 2 2 2
## 14 2 2 2 1 1 2
## 15 2 2 2 2 2 2
## 16 1 2 2 2 2 2
## 17 2 2 2 1 2 2
## 18 2 2 3 2 3 2
## 19 2 2 2 2 2 2
## 20 2 2 2 2 2 2
## 21 2 2 2 1 2 2
## 22 2 2 3 1 2 2
## 23 2 2 1 1 2 2
## 24 2 2 2 2 2 3
## 25 2 2 3 1 2 2
## 26 2 2 3 1 2 2
## 27 2 2 2 1 2 2
## 28 2 2 2 1 3 2
## 29 2 2 2 2 2 2
## 30 2 2 3 2 3 3
## 31 2 2 2 2 2 2
## 32 2 2 3 1 3 2
## 33 2 2 3 2 2 2
## 34 2 2 3 2 3 3
## 35 2 2 3 2 2 2
## 36 2 2 3 2 3 2
## 37 2 2 2 1 3 2
## 38 2 2 2 2 3 2
## 39 2 2 2 2 2 2
## 40 2 2 2 2 3 3
## 41 2 2 2 1 3 2
## 42 2 2 3 1 3 2
## 43 3 3 3 3 3 2
## 44 2 2 3 2 3 2
## 45 2 2 3 2 3 3
## 46 2 2 3 2 3 3
## 47 2 2 2 2 2 2
## 48 3 2 3 2 3 2
## 49 2 2 3 2 2 3
## 50 3 2 3 2 3 3
## 51 2 3 3 2 3 3
## 52 2 3 2 2 3 2
## 53 2 2 3 2 2 3
## 54 0 3 3 2 3 3
## 55 3 0 3 2 3 3
## 56 3 3 0 2 3 3
## 57 2 2 2 0 2 3
## 58 3 3 3 2 0 3
## 59 3 3 3 3 3 0
将网络变成无向网络
boya_wx <- as.undirected(boya_net, mode = "collapse",
edge.attr.comb = list(weight = "sum", "ignore"))boya_k_all <- coreness(boya_net, mode = "all")
boya_k_all## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 23 23 23 23 23 23 23 23 15 23 14 23 23 23 23 23 23 12 23 17 23 21 23 21 19 21
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 23 19 23 20 23 9 21 8 16 9 23 11 20 6 16 12 1 7 12 10 23 5 19 2 10 12
## 53 54 55 56 57 58 59
## 12 4 3 1 18 2 1
plot(boya_net, vertex.label = NA, vertex.colro = colors(boya_k_all))## Warning in if (distinct) c[!duplicated(t(col2rgb(c)))] else c: the condition has
## length > 1 and only the first element will be used
boya_k_in <- coreness(boya_net, mode = "in")
boya_k_in## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 11 10 11 11 11 11 11 10 8 11 3 11 10 11 11 10 11 5 11 9 11 7 11 10 10 10
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 9 6 11 10 10 0 10 4 7 2 10 5 10 2 7 3 0 4 4 4 10 2 10 0 4 4
## 53 54 55 56 57 58 59
## 5 2 2 0 10 1 0
plot(boya_net, vertex.label = NA, vertex.colro = colors(boya_k_in))## Warning in if (distinct) c[!duplicated(t(col2rgb(c)))] else c: the condition has
## length > 1 and only the first element will be used
boya_k_out <- coreness(boya_net, mode = "out")
boya_k_out## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 11 11 11 11 11 11 11 11 7 11 9 11 11 11 11 11 11 7 11 8 11 11 11 11 9 10
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
## 11 11 11 5 11 8 10 4 8 6 11 6 8 4 8 8 1 3 7 6 9 3 9 2 5 8
## 53 54 55 56 57 58 59
## 6 2 1 1 5 1 1
plot(boya_net, vertex.label = NA, vertex.colro = colors(boya_k_out))## Warning in if (distinct) c[!duplicated(t(col2rgb(c)))] else c: the condition has
## length > 1 and only the first element will be used
boya_attr <- get.data.frame(boya_net, what = "vertices")
boya_attr## name label gender leader
## 1 1 刘圣辰 1 1
## 2 2 宋庆宇 1 0
## 3 3 焦佳升 1 0
## 4 4 肖婷婷 0 1
## 5 5 徐天赐 1 0
## 6 6 曹成龙 1 1
## 7 7 杨江南 1 1
## 8 8 韩特梁 1 0
## 9 9 李宏宇 1 0
## 10 10 段效智 1 1
## 11 11 王悦翔 1 0
## 12 12 张敏中 1 0
## 13 13 吴双 0 0
## 14 14 张质源 1 0
## 15 15 吴极 1 1
## 16 16 李洋 1 0
## 17 17 王慎行 1 0
## 18 18 陈家鏖 1 0
## 19 19 米元博 1 0
## 20 20 胥德胜 1 0
## 21 21 赵康辰 1 0
## 22 22 段蕴歆 0 0
## 23 23 吴宜家 1 0
## 24 24 刘擎 1 0
## 25 25 范友铭 1 0
## 26 26 唐静吾 1 0
## 27 27 王俊杰 1 0
## 28 28 崔健 1 0
## 29 29 谭健翔 1 0
## 30 30 洪佳鹏 1 0
## 31 31 刘露阳 0 0
## 32 32 姜慧强 1 0
## 33 33 蔡梦彤 0 1
## 34 34 王雅涵 0 1
## 35 35 朱腾 1 0
## 36 36 梁毅 1 0
## 37 37 周普 1 0
## 38 38 王鹏 1 0
## 39 39 王一晴 0 0
## 40 40 李凌霄 1 0
## 41 41 张瑞琦 1 0
## 42 42 杜航旗 1 0
## 43 43 张园园 0 0
## 44 44 吴昱晨 0 0
## 45 45 师千与 1 0
## 46 46 朱欣 0 0
## 47 47 邱培培 1 0
## 48 48 陆远梅 0 0
## 49 49 王睿捷 0 0
## 50 50 楚芳冰 0 0
## 51 51 王佳慧 0 0
## 52 52 王白成 1 0
## 53 53 宋庆法 1 0
## 54 54 Qiu 1 0
## 55 55 马改芝 0 0
## 56 56 伍天一 1 0
## 57 57 温杰 1 0
## 58 58 戴悦浩 1 0
## 59 59 晋嘉琪 1 0
boya_s <- network::as.network(as.matrix(boya_netm), directed = T)
network::set.vertex.attribute(boya_s, "gender", boya_attr$gender)
network::set.vertex.attribute(boya_s, "leader", boya_attr$leader)
boya_s## Network attributes:
## vertices = 59
## directed = TRUE
## hyper = FALSE
## loops = FALSE
## multiple = FALSE
## bipartite = FALSE
## total edges= 787
## missing edges= 0
## non-missing edges= 787
##
## Vertex attribute names:
## gender leader vertex.names
##
## No edge attributes
boya_m1 <- ergm(boya_s~edges)## Starting maximum pseudolikelihood estimation (MPLE):
## Evaluating the predictor and response matrix.
## Maximizing the pseudolikelihood.
## Finished MPLE.
## Stopping at the initial estimate.
## Evaluating log-likelihood at the estimate.
summary(boya_m1)##
## ==========================
## Summary of model fit
## ==========================
##
## Formula: boya_s ~ edges
##
## Iterations: 5 out of 20
##
## Monte Carlo MLE Results:
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -1.20841 0.04062 0 -29.75 <1e-04 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 4744 on 3422 degrees of freedom
## Residual Deviance: 3691 on 3421 degrees of freedom
##
## AIC: 3693 BIC: 3699 (Smaller is better.)
边的系数:-1.20841, ecount(boya_net)/(vcount(boya_net) *(vcount(boya_net) - 1)) = 密度
boya_m2 <- ergm(boya_s ~ edges + mutual)## Starting maximum pseudolikelihood estimation (MPLE):
## Evaluating the predictor and response matrix.
## Maximizing the pseudolikelihood.
## Finished MPLE.
## Starting Monte Carlo maximum likelihood estimation (MCMLE):
## Iteration 1 of at most 20:
## Optimizing with step length 1.
## The log-likelihood improved by 0.01012.
## Step length converged once. Increasing MCMC sample size.
## Iteration 2 of at most 20:
## Optimizing with step length 1.
## The log-likelihood improved by 0.004402.
## Step length converged twice. Stopping.
## Finished MCMLE.
## Evaluating log-likelihood at the estimate. Using 20 bridges: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .
## This model was fit using MCMC. To examine model diagnostics and check
## for degeneracy, use the mcmc.diagnostics() function.
summary(boya_m2)##
## ==========================
## Summary of model fit
## ==========================
##
## Formula: boya_s ~ edges + mutual
##
## Iterations: 2 out of 20
##
## Monte Carlo MLE Results:
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -2.31362 0.07354 0 -31.46 <1e-04 ***
## mutual 3.15862 0.14807 0 21.33 <1e-04 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 4744 on 3422 degrees of freedom
## Residual Deviance: 3132 on 3420 degrees of freedom
##
## AIC: 3136 BIC: 3148 (Smaller is better.)
boya_m3 <- ergm(boya_s ~ edges + nodematch("gender")+ nodematch("leader") + mutual)## Warning: `set_attrs()` is deprecated as of rlang 0.3.0
## This warning is displayed once per session.
## Starting maximum pseudolikelihood estimation (MPLE):
## Evaluating the predictor and response matrix.
## Maximizing the pseudolikelihood.
## Finished MPLE.
## Starting Monte Carlo maximum likelihood estimation (MCMLE):
## Iteration 1 of at most 20:
## Optimizing with step length 1.
## The log-likelihood improved by 0.01386.
## Step length converged once. Increasing MCMC sample size.
## Iteration 2 of at most 20:
## Optimizing with step length 1.
## The log-likelihood improved by 0.001517.
## Step length converged twice. Stopping.
## Finished MCMLE.
## Evaluating log-likelihood at the estimate. Using 20 bridges: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .
## This model was fit using MCMC. To examine model diagnostics and check
## for degeneracy, use the mcmc.diagnostics() function.
summary(boya_m3)##
## ==========================
## Summary of model fit
## ==========================
##
## Formula: boya_s ~ edges + nodematch("gender") + nodematch("leader") +
## mutual
##
## Iterations: 2 out of 20
##
## Monte Carlo MLE Results:
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -2.01258 0.09812 0 -20.512 <1e-04 ***
## nodematch.gender 0.50761 0.07708 0 6.586 <1e-04 ***
## nodematch.leader -0.80351 0.07231 0 -11.112 <1e-04 ***
## mutual 2.97704 0.15163 0 19.634 <1e-04 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 4744 on 3422 degrees of freedom
## Residual Deviance: 2967 on 3418 degrees of freedom
##
## AIC: 2975 BIC: 3000 (Smaller is better.)
boya %>%
filter(!is.na(receiver)) %>%
mutate(number = row.names(.)) %>%
select(number,sender, receiver) -> boya_remboya_rem %>%
left_join(nodes, by = c("sender" = "label")) %>%
rename(from = id) %>%
left_join(nodes, by = c("receiver" = "label")) %>%
rename(to = id) %>%
select(number, from, to) %>%
mutate(number = as.integer(number))-> boya_remset.seed(8675)
as.sociomatrix.eventlist <- function (eventlist, n)
{
g <- matrix(0, n, n)
if (NROW(eventlist) > 0) {
tabmat <- table(eventlist[, -1, drop = FALSE])
g[as.numeric(dimnames(tabmat)[[1]]), as.numeric(dimnames(tabmat)[[2]])] <- tabmat
}
g
}
BoyaNet <- as.sociomatrix.eventlist(boya_rem,59)BoyaNetICR <- boya_m$leader == 1
boya.coord<-gplot(BoyaNet,edge.lwd=BoyaNet^0.75,arrowhead.cex=log(as.edgelist.sna(BoyaNet)[,3])+.25,vertex.col=ifelse(BoyaNetICR,"red","blue"),vertex.cex=1.25,vertex.sides=ifelse(BoyaNetICR,4,100))BoyaNetICR <- boya_m$leader == 1
boyafit1<-rem.dyad(boya_rem,n=59,effects=c("CovInt"),covar=list(CovInt=BoyaNetICR), hessian=TRUE)## Warning in rem.dyad(boya_rem, n = 59, effects = c("CovInt"), covar = list(CovInt = BoyaNetICR), : Edgelist list contains loops (not currently supported); dropping self-interactions.
## Computing preliminary statistics
## Fitting model
## Obtaining goodness-of-fit statistics
summary(boyafit1)## Relational Event Model (Ordinal Likelihood)
##
## Estimate Std.Err Z value Pr(>|z|)
## CovInt.1 -0.353553 0.030006 -11.783 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Null deviance: 102034 on 6269 degrees of freedom
## Residual deviance: 101882.8 on 6268 degrees of freedom
## Chi-square: 151.1692 on 1 degrees of freedom, asymptotic p-value 0
## AIC: 101884.8 AICC: 101884.8 BIC: 101891.6
boyafit2<-rem.dyad(boya_rem,n=59,effects=c("CovSnd","CovRec"),covar=list(CovSnd=BoyaNetICR,CovRec=BoyaNetICR),hessian=TRUE)## Warning in rem.dyad(boya_rem, n = 59, effects = c("CovSnd", "CovRec"), covar = list(CovSnd = BoyaNetICR, : Edgelist list contains loops (not currently supported); dropping self-interactions.
## Computing preliminary statistics
## Fitting model
## Obtaining goodness-of-fit statistics
summary(boyafit2)## Relational Event Model (Ordinal Likelihood)
##
## Estimate Std.Err Z value Pr(>|z|)
## CovSnd.1 -0.233335 0.040180 -5.8072 6.352e-09 ***
## CovRec.1 -0.486969 0.044538 -10.9339 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Null deviance: 102034 on 6269 degrees of freedom
## Residual deviance: 101863.6 on 6267 degrees of freedom
## Chi-square: 170.3937 on 2 degrees of freedom, asymptotic p-value 0
## AIC: 101867.6 AICC: 101867.6 BIC: 101881.1