Skip to content

example of clustering for network models #16

@smjenness

Description

@smjenness

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions