Problems 10
Note that solutions for some problems rely on the solutions from previous solutions.
Q2 Calculate the density for both the marriage and business networks in the Padgett Florentine families dataset.
# get data
mar = Padgett_FlorentineFamilies$Marriage
bus = Padgett_FlorentineFamilies$Business
# calc measures
dMarriage = xDensity(mar)
dBusiness = xDensity(bus)
# display side by side
cbind(dMarriage,dBusiness)
dMarriage dBusiness
[1,] 0.1666667 0.125
Q3 Calculate the closeness centralization for the Florentine families using the marriage network.
xMakeStar <- function(n)
{
mat = matrix(0,n,n)
mat[,1] = 1
mat[1,] = 1
mat[1,1] = 0
return(mat)
}
xClosenessCentralization <- function(mat)
{
getsumdiff = function(fmat)
{
clo = xClosenessCentrality(fmat)[,4]
maxclo = max(clo)
return(sum(maxclo-clo))
}
n = nrow(mat)
star = xMakeStar(n)
sumdiffstar = getsumdiff(star)
sumdiffnet = getsumdiff(mat)
return(sumdiffnet/sumdiffstar)
}
xClosenessCentralization(mar)
[1] 0.4473016
The solution given uses the reciprocal closeness measure. Note that the network is not connected, which is not ideal for closeness centrality.
Q5 Calculate the connectedness and compactness for the marriage network and compare both measures with those obtained for the business network for the Padgett dataset.
results = matrix(0,2,2)
colnames(results) = c("Connectedness","Compactness")
rownames(results) = c("Marriage","Business")
results[1,1] = xConnectedness(mar)
results[1,2] = xCompactness(mar)
results[2,1] = xConnectedness(bus)
results[2,2] = xCompactness(bus)
results
Connectedness Compactness
Marriage 0.8750000 0.4376389
Business 0.4583333 0.2522222
The marriage network is more connected and has shorter distances than the business network. This is largely because the business network has 5 isolates.
Q6 Freeman’s EIES friendship network was measured at two time points. Dichotomize the network at each time point, such that x(i,j) if i considers j at least a “friend”, and x(i,j) = 0 otherwise. Calculate the density, connectedness and compactness for the friendship network at both time points. Compare the results for each of the three measures.
#dichotomize the networks
t1 = xDichotomize(Freeman_EIES$AcquaintanceT1,1,"GT")
t2 = xDichotomize(Freeman_EIES$AcquaintanceT2,1,"GT")
#calc measures
t1meas = cbind(xDensity(t1),xConnectedness(t1),xCompactness(t1))
t2meas = cbind(xDensity(t2),xConnectedness(t2),xCompactness(t2))
#display results
results = rbind(t1meas,t2meas)
colnames(results) = c("Density","Connectedness","Compactness")
results
Density Connectedness Compactness
[1,] 0.5171371 1 0.7580645
[2,] 0.6582661 1 0.8291331
>
The network gets denser over time, and distances become shorter.
Q8 Use Freeman’s EIES friendship network at times 1 and 2 (where the network is 1 when the person considers the other a friend or a good friend) to calculate arc reciprocity. What do you conclude?
cbind(xReciprocity(t1),xReciprocity(t2))
Value Value
Valid Dyads 496.0000000 496.0000000
%Valid Dyads 100.0000000 100.0000000
Density (valid dyads) 0.5171371 0.6582661
Mutual 220.0000000 281.0000000
Asymmetric 73.0000000 91.0000000
Null 203.0000000 124.0000000
DyadReciprocity 0.7508532 0.7553763
ArcReciprocity 0.8576998 0.8606432
>
c(.8577/.5171,.8606/.6583)
[1] 1.658673 1.307307
Reciprocity is high at both time periods -- above chance levels, as indicated by density. Because the arc reciprocity measure is about the same at the two time periods, but the network is denser at time 2, we conclude there is a slightly lower tendency to reciprocate at T2.
Q9 The Freeman EIES dataset contains information about the discipline of each node. Calculate a density table for time 2.
disc = Freeman_EIES$Attributes$Discipline
xd = xDensity(t2,ROWS=disc,COLS=disc)
rownames(xd) = c("Sociology","Anthropology","Mathematics","Other")
colnames(xd) = rownames(xd)
xd
Sociology Anthropology Mathematics Other
Sociology 0.7683824 0.5686275 0.6666667 0.5098039
Anthropology 0.6078431 0.9000000 0.9444444 0.6111111
Mathematics 0.7450980 0.6111111 0.6666667 0.7222222
Other 0.5784314 0.6111111 0.7222222 0.4000000
>
In general, we expect there to be more ties within group than between. Interestingly, the anthropologists have a strong tendency to regard mathematicians as friends -- stronger, in fact, than the reverse.