I am using igraph to explore assortativity of HLA profiles between linked individuals (HIV)
My ‘problem’ is that for each HLA group (A, B or C), I have 2 values associated with each vertex .
My goal is to determine if :
HLA A1 OR A2 are more likely to be ‘assortative’ in the network
HLA B1 OR B2 are more likely to be ‘assortative’...
HLA C1 OR C2 are more likely to be ‘assortative’...
For now, I compare it to a random distribution.
For example with HLA C (C1 or C2), I have 28 unique HLAC profile.
In a network with 286 vertices, First I calculate the rdm_assortativity as follow:
RandomSample <- sample(c(1,2,5,4,6,7,8,9,10,3,11,12,14,13,16,17,15,18,19,20,21,22,23,24,25,26,27,28), 286, replace=TRUE) ## my guess is that the dimension is incorrect because it does not take into account the 2 possibilities (C1 and C2)
rdm_assortativity=assortativity_nominal(graph=ALLEDGES2, types=RandomSample, directed = F)
Next, I want to determine the observed assortativity. What would you suggest?
For now, I manually created an additional column ‘HLAC_match’ with 1 for ‘match’ and 2 for ’no match’ and then calculate the assortativity as follow:
assortativity_nominal(graph=ALLEDGES2, types=HLAATTRIBUTES$HLAC_match, directed = F) # where ALLEDGES is my edge list
Does that make sense?
thank you in advance!