# load the Florentine marriage network
# included with the ergm package
data(florentine)
y <- flomarriage
# Competing models:
formulae <- c(y ~ edges,
y ~ edges + gwesp(log(2),fixed=TRUE),
y ~ edges + gwdegree(log(2),fixed=TRUE))
# Model selection via auto-RJ exchange algorithm
# (this should take about 1.5 minutes)
flo <- bergmS(formulae,
iters=10000,
aux.iters=1000,
main.iters=rep(1000,3),
burn.in=rep(100,3),
gammas=c(0.8,1,1))
# MCMC diagnostics
flo.out <- bergmS.output(flo)
# Bayesian goodness-of-fit test (for the best model)
bgof(flo.out,
lags=200,
n.sim=100,
n.deg=10,
n.dist=10,
n.esp=5)Run the code above in your browser using DataLab