mtergm {btergm}R Documentation

Estimate a TERGM by MCMC-MLE


Estimate a TERGM by Markov Chain Monte Carlo Maximum Likelihood Estimation


mtergm(formula, constraints = ~., returndata = FALSE, verbose = TRUE, ...)



Formula for the TERGM. Model construction works like in the ergm package with the same model terms etc. (for a list of terms, see help("ergm-terms")). The networks to be modeled on the left-hand side of the equation must be given either as a list of network objects with more recent networks last (i.e., chronological order) or as a list of matrices with more recent matrices at the end. dyadcov and edgecov terms accept time-independent covariates (as network or matrix objects) or time-varying covariates (as a list of networks or matrices with the same length as the list of networks to be modeled).


Constraints of the ERGM. See ergm for details.


Return the processed input data instead of estimating and returning the model? In the btergm case, this will return a data frame with the dyads of the dependent variable/network and the change statistics for all covariates. In the mtergm case, this will return a list object with the blockdiagonal network object for the dependent variable and blockdiagonal matrices for all dyadic covariates and the offset matrix for the structural zeros.


Print details about data preprocessing and estimation settings.


Further arguments to be handed over to the ergm function.


The mtergm function computes TERGMs by MCMC MLE (or MPLE with uncorrected standard errors) via blockdiagonal matrices and structural zeros. It acts as a wrapper for the ergm package. The btergm function is faster than the mtergm function but is only asymptotically unbiased the longer the time series. The mtergm function yields unbiased estimates and standard errors but may suffer from degeneracy if the model is not specified in good keeping with the true data-generating process.


Philip Leifeld, Skyler J. Cranmer, Bruce A. Desmarais


Leifeld, Philip, Skyler J. Cranmer and Bruce A. Desmarais (2017): Temporal Exponential Random Graph Models with btergm: Estimation and Bootstrap Confidence Intervals. Journal of Statistical Software 83(6): 1-36. doi: 10.18637/jss.v083.i06.

See Also

btergm tbergm



networks <- list()
for (i in 1:10) {          # create 10 random networks with 10 actors
  mat <- matrix(rbinom(100, 1, .25), nrow = 10, ncol = 10)
  diag(mat) <- 0           # loops are excluded
  nw <- network(mat)       # create network object
  networks[[i]] <- nw      # add network to the list

covariates <- list()
for (i in 1:10) {          # create 10 matrices as covariate
  mat <- matrix(rnorm(100), nrow = 10, ncol = 10)
  covariates[[i]] <- mat   # add matrix to the list

## Not run: 
fit2 <- mtergm(networks ~ edges + istar(2) + edgecov(covariates))

## End(Not run)

# For examples with real data, see help("knecht") or help("alliances").

[Package btergm version 1.10.3 Index]