ergmx.tergm#

ergmx.tergm(networks, formula, *, estimate='CMLE', times=None, constraints=None, offset_coef=None, bipartite=None, init=None, seed=None, eval_loglik=True, control=None, targets=None, target_stats=None, egmme=None, na_impute=None, **control_args)[source]#

Fit a temporal ERGM to a series of networks by conditional maximum likelihood, as R’s tergm(..., estimate="CMLE").

Each transition, from one network of the series to the next, is modeled conditionally on the network before it, with tergm’s operators: Form(~terms) models the ties that form (its terms are those of the union of the previous and the current network), Persist(~terms) those that persist (the intersection; Diss() is the same with the signs of the coefficients reversed), Cross(~terms) the current network and Change(~terms) the dyads that changed. A model with only Form() and Persist() (or Diss()) is separable (a STERGM): formation and persistence are independent given the previous network. Every transition has the same coefficients, unless their linear models (lm=) make them depend on the time (see ergmx.NetSeries()).

Parameters:
  • networks (list of igraph.Graph or networkx.Graph, or NetSeries) – The networks, in time order, on the same vertices.

  • formula (str or terms) – For example "Form(~edges + mutual + gwesp(0.5, fixed=TRUE)) + Persist(~edges + mutual)".

  • estimate ({"CMLE", "CMPLE", "EGMME"}) – The conditional MLE (Monte Carlo, or exact for dyad-independent models), the conditional maximum pseudo-likelihood estimate, or tergm’s equilibrium generalized method of moments estimate (EGMME), which fits the process to a single network and the durations of its ties: the coefficients whose process has, at equilibrium, the target_stats of the statistics of targets.

  • targets (str or terms) – For the EGMME, a formula of the statistics to match: ergm terms, and statistics of tie ages (mean.age, edge.ages, edges.ageinterval, edgecov.ages, nodefactor.mean.age).

  • target_stats (array-like, optional) – Their values: by default, the network’s (necessary for the ages).

  • egmme (dict, optional) – Settings of the EGMME’s stochastic approximation (see ergmx._temporal._EGMME_DEFAULTS): its burn-in, gradient runs, gain, subphases and iterations, and the length of each time step’s chain (min_steps…).

  • times (list of numbers, optional) – The times the networks were observed (0, 1, 2… by default), for .Time and .TimeDelta in linear models.

  • na_impute (str or list of str, optional) – How to impute the missing dyads of the networks transitioned from, as tergm’s CMLE.NA.impute: see ergmx.NetSeries().

  • constraints – As in ergmx.ergm().

  • offset_coef – As in ergmx.ergm().

  • bipartite – As in ergmx.ergm().

  • init – As in ergmx.ergm().

  • seed – As in ergmx.ergm().

  • eval_loglik – As in ergmx.ergm().

  • control – As in ergmx.ergm().

Returns:

ErgmFit – Its simulate() continues the series with time_slices=.