EpiModel-Gallery icon indicating copy to clipboard operation
EpiModel-Gallery copied to clipboard

example of clustering for network models

Open smjenness opened this issue 6 years ago • 1 comments

For example, people are clustered in households, which are clustered in neighborhoods, and there is a strong propensity for in-household mixing, a slightly weaker propensity for in-neighborhood mixing, and a zero propensity for cross-neighborhood mixing.

nw <- network.initialize(100, directed = FALSE)

hh <- rep(1:4, each = 25)
nb <- rep(1:2, each = 50)

nw %v% "hh" <- hh
nw %v% "nb" <- nb

fit <- ergm(nw ~ edges + nodemix("nb", base = c(1,3)),
            target.stats = c(50, 0))
sim <- simulate(fit, nsim = 1e4, statsonly = TRUE,
                monitor = ~nodemix("nb", base = 0)+nodemix("hh", base = 0))
colMeans(sim)

smjenness avatar Dec 14 '18 17:12 smjenness

this sounds interesting!

For example, people are clustered in households, which are clustered in neighborhoods, and there is a strong propensity for in-household mixing, a slightly weaker propensity for in-neighborhood mixing, and a zero propensity for cross-neighborhood mixing.

nw <- network.initialize(100, directed = FALSE)

hh <- rep(1:4, each = 25) nb <- rep(1:2, each = 50)

nw %v% "hh" <- hh nw %v% "nb" <- nb

fit <- ergm(nw ~ edges + nodemix("nb", base = c(1,3)), target.stats = c(50, 0)) sim <- simulate(fit, nsim = 1e4, statsonly = TRUE, monitor = ~nodemix("nb", base = 0)+nodemix("hh", base = 0)) colMeans(sim)

martinamorris avatar Dec 14 '18 17:12 martinamorris