Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of clustering for network models #16

Open
smjenness opened this issue Dec 14, 2018 · 1 comment
Open

example of clustering for network models #16

smjenness opened this issue Dec 14, 2018 · 1 comment

Comments

@smjenness
Copy link
Contributor

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
Copy link

martinamorris commented Dec 14, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants