Learn R Programming

Bergm (version 4.2.0)

bergm: Parameter estimation for Bayesian ERGMs

Description

Function to fit Bayesian exponential random graphs models using the approximate exchange algorithm.

Usage

bergm(formula, burn.in = 100, main.iters = 1000, aux.iters = 1000,
  prior.mean = NULL, prior.sigma = NULL, nchains = NULL,
  gamma = 0.5, sigma.epsilon = NULL, ...)

Arguments

formula

formula; an ergm formula object, of the form <network> ~ <model terms> where <network> is a network object and <model terms> are ergm-terms.

burn.in

count; number of burn-in iterations at the beginning of an MCMC run. If nchains > 2, it refers to the number of burn-in iterations for every chain of the population.

main.iters

count; number of iterations for the MCMC chain(s) excluding burn-in. If nchains > 2, it refers to the number of iterations for every chain of the population.

aux.iters

count; number of auxiliary iterations used for network simulation.

prior.mean

vector; mean vector of the multivariate Normal prior. By default set to a vector of 0's.

prior.sigma

square matrix; variance/covariance matrix for the multivariate Normal prior. By default set to a diagonal matrix with every diagonal entry equal to 100.

nchains

count; number of chains of the population MCMC. By default set to twice the model dimension (number of model terms). If the model is one-dimensional, nchains = 1.

gamma

scalar; ``parallel ADS move factor''. If the model is one-dimensional, nchains = 1 and gamma = sigma.espilon and is used as the variance of the Normal proposal distribution.

sigma.epsilon

square matrix; variance/covariance matrix for the multivariate Normal proposal when nchains > 2. By default set to a diagonal matrix with every diagonal entry equal to 0.0025. If the model is one-dimensional, sigma.espilon = gamma and is used as the variance of the Normal proposal distribution.

...

additional arguments, to be passed to lower-level functions.

References

Caimo, A. and Friel, N. (2011), "Bayesian Inference for Exponential Random Graph Models," Social Networks, 33(1), 41-55. http://arxiv.org/abs/1007.5192

Caimo, A. and Friel, N. (2014), "Bergm: Bayesian Exponential Random Graphs in R," Journal of Statistical Software, 61(2), 1-25. jstatsoft.org/v61/i02

Examples

Run this code
# NOT RUN {
# Load the florentine marriage network
data(florentine)

# Posterior parameter estimation:

p.flo <- bergm(flomarriage ~ edges + kstar(2),
               burn.in = 50,
               aux.iters = 500,
               main.iters = 500,
               gamma = 1)

# Posterior summaries:

bergm.output(p.flo)

# Bayesian goodness-of-fit test:

bgof(p.flo,
     aux.iters = 500,
     sample.size = 50,
     n.deg = 10,
     n.dist = 9,
     n.esp = 6)

# }

Run the code above in your browser using DataLab