1

我有三个不同的矩阵,他们的 Krackhardt 效率对我来说似乎是错误的。前两个矩阵在拓扑上是等价的,但它们的效率不同。任何人都有不一致的解释?

对于第一个矩阵,效率为 1:

A <- matrix(c(0,1,0,0,0,0,0,0,0,0,
          0,0,1,0,0,0,0,0,0,0,
          0,0,0,1,0,0,0,0,0,0,
          0,0,0,0,1,0,0,0,0,0,
          0,0,0,0,0,1,0,0,0,1,
          0,0,0,0,0,0,1,0,0,0,
          0,0,0,0,0,0,0,1,0,0,
          0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,1,0),ncol=10)
A_net <- network(A,directed=TRUE)
g_eff <- efficiency(A_net)
plot.network(A_net, vertex.col = "white", vertex.border = col_ama, 
         usearrows=FALSE, edge.col=col_gri, vertex.lwd = 3.5,
         vertex.cex = 3.5)
title(paste("Efficiency =",round(g_eff,3)))

不同效率的等价矩阵:

A <- matrix(c(0,0,0,0,1,0,0,0,0,0,
          1,0,1,0,0,0,0,0,0,0,  
          0,0,0,0,0,0,1,0,0,0,
          0,0,1,0,0,0,0,0,0,0,
          0,0,0,0,0,1,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,1,0,
          0,0,0,1,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,1,
          0,0,0,0,0,0,0,0,0,0),ncol=10)
A_net <- network(A,directed=FALSE)
g_eff <- efficiency(A_net)
plot.network(A_net, vertex.col = "white", vertex.border = col_ama, 
         usearrows=FALSE, edge.col=col_gri, vertex.lwd = 3.5,
         vertex.cex = 3.5)
title(paste("Efficiency =",round(g_eff,3)))

第三个矩阵有两个具有最少边数 (n_i-1) 的分量,但它们的效率不是一个。它与帮助中的公式都不匹配:

(1 - [ |E(G)| - Sum(N_i-1,i=1,..,n) ]/[ Sum((N_i-1)^2,i=1,..,n) ]   = 1-[8-(2+4)]/[4+16] = .9)

第三个矩阵:

A <- matrix(c(0,0,0,0,1,0,0,0,0,0,
          1,0,0,0,0,0,0,0,0,0,  
          0,0,0,0,0,0,1,0,0,0,
          0,0,1,0,0,0,0,0,0,0,
          0,0,0,0,0,1,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,1,0,
          0,0,0,1,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,1,
          0,0,0,0,0,0,0,0,0,0),ncol=10)
A_net <- network(A,directed=FALSE)
g_eff <- efficiency(A_net)
g_eff
plot.network(A_net, vertex.col = "white", vertex.border = col_ama, 
         usearrows=FALSE, edge.col=col_gri, vertex.lwd = 3.5,
         vertex.cex = 3.5)
title(paste("Efficiency =",round(g_eff,3)))
4

1 回答 1

0

看来您的示例是错误的:在第一种情况下,您正在使用有向网络,而在第二种情况下,您正在使用无向网络(检查您的网络强制声明 - 顺便说一句,您可以只使用矩阵)。这是一个证明前两个实际上是等价的:

> A <- matrix(c(0,1,0,0,0,0,0,0,0,0,
+           0,0,1,0,0,0,0,0,0,0,
+           0,0,0,1,0,0,0,0,0,0,
+           0,0,0,0,1,0,0,0,0,0,
+           0,0,0,0,0,1,0,0,0,1,
+           0,0,0,0,0,0,1,0,0,0,
+           0,0,0,0,0,0,0,1,0,0,
+           0,0,0,0,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,1,0),ncol=10)
> A
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    0    0    0    0    0    0    0    0     0
 [2,]    1    0    0    0    0    0    0    0    0     0
 [3,]    0    1    0    0    0    0    0    0    0     0
 [4,]    0    0    1    0    0    0    0    0    0     0
 [5,]    0    0    0    1    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0    0    0    0     0
 [7,]    0    0    0    0    0    1    0    0    0     0
 [8,]    0    0    0    0    0    0    1    0    0     0
 [9,]    0    0    0    0    0    0    0    0    0     1
[10,]    0    0    0    0    1    0    0    0    0     0
> B<-matrix(c(0,0,0,0,1,0,0,0,0,0,
+           1,0,1,0,0,0,0,0,0,0, 
+           0,0,0,0,0,0,1,0,0,0,
+           0,0,1,0,0,0,0,0,0,0,
+           0,0,0,0,0,1,0,0,0,0,
+           0,0,0,0,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,1,0,
+           0,0,0,1,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,0,1,
+           0,0,0,0,0,0,0,0,0,0),ncol=10)
> A
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    0    0    0    0    0    0    0    0     0
 [2,]    1    0    0    0    0    0    0    0    0     0
 [3,]    0    1    0    0    0    0    0    0    0     0
 [4,]    0    0    1    0    0    0    0    0    0     0
 [5,]    0    0    0    1    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0    0    0    0     0
 [7,]    0    0    0    0    0    1    0    0    0     0
 [8,]    0    0    0    0    0    0    1    0    0     0
 [9,]    0    0    0    0    0    0    0    0    0     1
[10,]    0    0    0    0    1    0    0    0    0     0
> B
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    1    0    0    0    0    0    0    0     0
 [2,]    0    0    0    0    0    0    0    0    0     0
 [3,]    0    1    0    1    0    0    0    0    0     0
 [4,]    0    0    0    0    0    0    0    1    0     0
 [5,]    1    0    0    0    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0    0    0    0     0
 [7,]    0    0    1    0    0    0    0    0    0     0
 [8,]    0    0    0    0    0    0    0    0    0     0
 [9,]    0    0    0    0    0    0    1    0    0     0
[10,]    0    0    0    0    0    0    0    0    1     0
> efficiency(A)
[1] 1
> efficiency(B)
[1] 1

如果您通过设置“directed=FALSE”来对称化(这就是您在示例中对其中一个网络所做的操作),那么您将获得 0.889 的效率。请注意,这与我们应该得到的匹配:

1 - (18 - 9)/(选择(10,2)*2-9) = 0.889

(请记住,Krackhardt 效率将所有网络视为有向图,因此相互边算作两条边。另外,我注意到您似乎从手册页中错误地复制了公式,这可能是您混淆的一部分。)

您的第三个矩阵再次是效率 1,因为它没有多余的边缘:

> C<-matrix(c(0,0,0,0,1,0,0,0,0,0,
+           1,0,0,0,0,0,0,0,0,0, 
+           0,0,0,0,0,0,1,0,0,0,
+           0,0,1,0,0,0,0,0,0,0,
+           0,0,0,0,0,1,0,0,0,0,
+           0,0,0,0,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,1,0,
+           0,0,0,1,0,0,0,0,0,0,
+           0,0,0,0,0,0,0,0,0,1,
+           0,0,0,0,0,0,0,0,0,0),ncol=10)
> C
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    1    0    0    0    0    0    0    0     0
 [2,]    0    0    0    0    0    0    0    0    0     0
 [3,]    0    0    0    1    0    0    0    0    0     0
 [4,]    0    0    0    0    0    0    0    1    0     0
 [5,]    1    0    0    0    0    0    0    0    0     0
 [6,]    0    0    0    0    1    0    0    0    0     0
 [7,]    0    0    1    0    0    0    0    0    0     0
 [8,]    0    0    0    0    0    0    0    0    0     0
 [9,]    0    0    0    0    0    0    1    0    0     0
[10,]    0    0    0    0    0    0    0    0    1     0
> efficiency(C)
[1] 1

您的问题源于对称化(使用directed=FALSE 将C 强制转换为网络对象)。这增加了额外的边缘,导致

1- (16 - 3 - 5) / (选择(4,2)*2 - 3 + 选择(6,2)*2 - 5) = 0.7647059

这相当于 sna 给你的:

> efficiency(symmetrize(C))
[1] 0.7647059

希望这能说明问题!

于 2015-06-16T20:44:55.757 回答