I'm not the best at math or graph theory and I'm trying to understand the formula for assortativity here

$$r=\frac{\sum_i e_{ii}-\sum_i a_i b_i}{1-\sum_i a_i b_i}$$ where $e(i,j)$ is the fraction of edges connecting vertices of type i and j, $a_i=\sum_j e_{ij}$ and $b_j=\sum_i e_{ij}$

Using some data I just made up here in R can someone explain how this works?

edgelist=structure(list(nominator1 = structure(c(3L, 4L, 1L, 2L), .Label = c("Angela", 
"Jeff", "Jim", "Pam"), class = "factor"), nominee1 = structure(c(1L, 
2L, 3L, 2L), .Label = c("Andy", "Angela", "Jeff"), class = "factor")), class = "data.frame", row.names = c(NA, 


  nominator1 nominee1
1        Jim     Andy
2        Pam   Angela
3     Angela     Jeff
4       Jeff   Angela

And these are the attributes of people (some people are not in the network I provided I know)

structure(list(names = structure(c(6L, 7L, 5L, 2L, 1L, 8L, 3L, 
4L), .Label = c("Andy", "Angela", "Eric", "Jamie", "Jeff", "Jim", 
"Pam", "Tim"), class = "factor"), gender = structure(c(3L, 2L, 
3L, 2L, 3L, 1L, 1L, 2L), .Label = c("", "F", "M"), class = "factor")), class = "data.frame", row.names = c(NA, 


   names gender
1    Jim      M
2    Pam      F
3   Jeff      M
4 Angela      F
5   Andy      M
6    Tim       
7   Eric       
8  Jamie      F

Can someone please explain step by step how this metric would be calculated using the data provided?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.