a foray into network analysis

Marriage Networks of Florence

This post takes the example provided in Kosuke Imai’s Quantitative Social Science: An Introduction. It provides some exploration of network analysis through looking at the florentine dataset which counts the marraige relationships between several Florentine families in the 15th century. My historical side knows that our analysis should show that the MediciFamilyMedici Family should appear at the center of all of the political intrigue. Let’s see if the analysis plays out.

Formatting the Data

The florentine data set comes as a dataframe. In order to work with igraph it will need to be converted to a matrix with named columns and rows. That conversion can be done here:

Starting Table

FAMILYACCIAIUOLALBIZZIBARBADORIBISCHERI
ACCIAIUOL0000
ALBIZZI0000
BARBADORI0000
BISCHERI0000
CASTELLAN0010
GINORI0100
GUADAGNI0101
LAMBERTES0000
MEDICI1110
PAZZI0000
PERUZZI0001
PUCCI0000
RIDOLFI0000
SALVIATI0000
STROZZI0001
TORNABUON0000

Now we need to manipulate the dataframe to turn it into a matrix object so that we can pass it to the igraph package.

florentine_g <- florentine %>% 
  filter(FAMILY != "PUCCI") %>% 
  select(-PUCCI) %>% 
  select(-FAMILY) %>% 
  as.matrix()

row.names(florentine_g) <- florentine[-12,1] %>% as.vector()

Now we need to pass this object to igraph. The path is undirected because there is no ordinality to this data. It does not encode if one family proposed the marriage to the other group. If this were the case then there could be some directedness to the graph. In this case there isn’t so that is the parameter we will pass.

florentine_g <- graph.adjacency(florentine_g, mode = "undirected", diag = FALSE)

Now we can plot based on several features:

  • degree

  • closeness

  • betweeness

  • PageRank

Visualising the Network

plot(florentine_g, vertex.size = betweenness(florentine_g), main = "Betweeness")
plot(florentine_g, vertex.size = closeness(florentine_g)*1000, main = "Closeness")
plot(florentine_g, vertex.size = degree(florentine_g)*10, main = "Degree")

The Numeric Outputs

floretine_networks <- data_frame(
  family = names(closeness(florentine_g)),
  closeness = closeness(florentine_g),
  degree = degree(florentine_g),
  betweeness = betweenness(florentine_g)
) %>% 
  arrange(-closeness)

kable(floretine_networks)
familyclosenessdegreebetweeness
MEDICI0.0400000647.500000
RIDOLFI0.0357143310.333333
ALBIZZI0.0344828319.333333
TORNABUON0.034482838.333333
GUADAGNI0.0333333423.166667
BARBADORI0.031250028.500000
STROZZI0.031250049.333333
BISCHERI0.028571439.500000
CASTELLAN0.027777835.000000
SALVIATI0.0277778213.000000
ACCIAIUOL0.026315810.000000
PERUZZI0.026315832.000000
GINORI0.023809510.000000
LAMBERTES0.023255810.000000
PAZZI0.020408210.000000

Additionally, the “pagerank” algorithm can be used.

plot(florentine_g, vertex.size = page.rank(graph = florentine_g, directed = FALSE)$vector*100)
$```

![](./unnamed-chunk-6-1.png)

Reuse

Citation

BibTeX citation:
@online{dewitt2018,
  author = {Michael E. DeWitt},
  title = {a foray into network analysis},
  date = {2018-09-16},
  url = {https://michaeldewittjr.com/blog/2018-09-16-a-foray-into-network-analysis/},
  langid = {en}
}
For attribution, please cite this work as:
Michael E. DeWitt. September 16, 2018. "a foray into network analysis". https://michaeldewittjr.com/blog/2018-09-16-a-foray-into-network-analysis/.