0

Thank you for your time in advance. I am attempting to identify a method to calculate in-degree Bonacich Power Centrality in R. I'm a long-time UCINET user attempting to make the switch. In UCINET, this is done selecting Beta Centrality (Bonacich Power), and selecting "in-centrality" for the direction.

In R, it doesn't seem as though there is a way to calculate this using either sna or igraph packages. Here it is for bonpow in sna:

bonpow(dat, g=1, nodes=NULL, gmode="digraph", diag=FALSE, tmaxdev=FALSE, 
       exponent=1, rescale=FALSE, tol=1e-07)

I do specify digraph, but I am not able to replicate the analysis in R.

Similarly, here it is for power_centrality in igraph:

power_centrality(graph, nodes = V(graph), loops = FALSE,
      exponent = 1, rescale = FALSE, tol = 1e-07, sparse = TRUE)

Here, there does not seem to be a way to specify that it is a directed graph (although you can specify it when defining the network). However, you can estimate it for betweenness centrality.

In neither case do I seem to be able to specify in-degree or out-degree power centrality. Any help is appreciated. Is there something either in these or in a different package that I may be overlooking?

gvegayon
  • 812
  • 12
  • 23

1 Answers1

0

I'm not sure about what do you mean by direction since the original paper, seems to me, does not deal with it. Now, a thing that is usually done with these statistics that are calculated directly from the adjacency matrix is "change the direction" by taking the transpose of the statistic (for example, when computing exposure in the netdiffuseR package we allow the user to compute "incoming" or "outgoing" exposure by just taking the transpose of the adjacency matrix). When you take the transpose, you are essentially flipping the directionality of the ties, i.e. i->j turns to j->i.

If that's what UCINET does (again, not completely sure what it is), then you can get the "incoming"/"outgoing" version by transposing the network. Here is a toy example:

# Loading the sna package (btw: igraph's implementation is a copy of
# sna's). I wrap it around suppressMessages to avoid the verbose
# print that the package has
suppressMessages(library(sna))

# This is random graph I generated with 10 vertices
net <- structure(
  c(0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 
    0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 
    0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 
    0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 
    0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0),
  .Dim = c(10L, 10L)
  )

# Here is the default
bonpow(net)
#>  [1] -0.8921521 -0.7658658 -0.9165947 -1.4176664 -0.6151369 -0.7862345
#>  [7] -0.9206684 -1.3565601 -1.0347335 -1.0062173

# Here I'm getting the transpose of the adjmat
net2 <- t(net)

# The output is different (as you can see)
bonpow(net2)
#>  [1] -0.8969158 -1.1026305 -0.6336011 -0.7158869 -1.2960022 -0.9545159
#>  [7] -1.1684592 -0.8845729 -1.0368018 -1.1190876

Created on 2019-11-20 by the reprex package (v0.3.0)

gvegayon
  • 812
  • 12
  • 23
  • This definitely helps. Incoming/outgoing refers to whether it's measuring in-degree or out-degree. This is an elementary question, but it looks like the the in-degree is measured in the columns (and out-degree in the rows), so that the first position in the network has been nominated 4 times by 4, 6, 7, and 9, correct? So then the first one would measure in-degree power centrality, and the transpose would measure out-degree power centrality? – Jonathan D. Nov 21 '19 at 15:45
  • What you are saying makes sense. I think that, by default, the measure is framed as in-degree centrality (as it is normally done in centrality measurements), and taking the transpose should be the out-degree. But again, I'm not sure what is the distinction that UCINET does (wasn't able to find the manual describing this), but from my experience it should be simply what I've described. HIH – gvegayon Nov 21 '19 at 18:31