
Simulate Feld's 1991 Marketville Network
simulate_feld_1991.Rd
Creates an undirected network using the degree distribution from Feld (1991) based on the "Marketville" high school data. Uses the configuration model to generate the network structure.
Details
The friendship paradox—where most individuals have fewer friends than their friends do—emerges naturally due to degree heterogeneity in this network.
Examples
# Generate the network
g <- simulate_feld_1991(seed = 42)
#> Warning: The `method` argument of `sample_degseq()` must be fast.heur.simple instead of
#> simple.no.multiple as of igraph 2.1.0.
#> ℹ The deprecated feature was likely used in the socmod package.
#> Please report the issue to the authors.
#> Error in igraph::sample_degseq(degrees, method = "simple.no.multiple"): At vendor/cigraph/src/games/degree_sequence.c:145 : No simple undirected graph can realize the given degree sequence. Invalid value
# Plot degree vs. mean degree of friends to show the paradox
deg <- igraph::degree(g)
#> Error: object 'g' not found
mean_neighbor_deg <- sapply(igraph::V(g), function(v) {
nbs <- igraph::neighbors(g, v)
if (length(nbs) == 0) return(NA)
mean(igraph::degree(g, v = nbs))
})
#> Error: object 'g' not found
plot(deg, mean_neighbor_deg,
xlab = "Individual's Friends",
ylab = "Mean Friends of Friends")
#> Error: object 'deg' not found
abline(0, 1, col = "red")
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
# Proportion of individuals with fewer friends than their friends
mean(deg < mean_neighbor_deg, na.rm = TRUE)
#> Error: object 'deg' not found