ergmx.gof#

ergmx.gof(x, formula=None, coef=None, *, constraints=None, nsim=100, stats=None, seed=None, interval=None, burnin=None, n_chains=None, triadic_weight=None, by=None)[source]#

Goodness of fit of an ERGM, like R’s gof().

Simulates nsim networks from the model and compares their degree, edgewise shared partner and geodesic distance distributions, and the model statistics, with the observed network’s.

Parameters:
  • x (ErgmFit, or igraph.Graph / networkx.Graph) – A fitted model, or a network (then give formula and coef).

  • formula – The model and its coefficients, when x is a network.

  • coef – The model and its coefficients, when x is a network.

  • constraints (str, optional) – Sample space constraints, when x is a network; a fit’s own are used otherwise.

  • nsim (int) – Number of simulated networks.

  • stats (list of str, optional) – Among "degree" (undirected), "idegree", "odegree" (directed), "b1degree", "b2degree" (bipartite), "espartners", "dspartners", "distance" and "model". The default is ergm’s: degrees, edgewise shared partners, distances and the model statistics; for bipartite networks, the degrees of each mode, dyadwise shared partners, distances and the model statistics.

  • interval (int, optional) – MCMC proposals between and before the simulated networks. Default to the interval the fit ended with (1024 otherwise), and 16 times that.

  • burnin (int, optional) – MCMC proposals between and before the simulated networks. Default to the interval the fit ended with (1024 otherwise), and 16 times that.

  • by (str, optional) – A vertex attribute, such as the level of a multilevel network: the distributions are then of the network within each of its values (tables "degree.<value>", "espartners.<value>"…) and, with two values, of each value’s number of ties to the other ("affiliations.<value>"; in directed networks, arcs from the first value to the second), with the model statistics.

Notes

With several networks (ergmx.Networks(), ergmx.NetSeries()), the distributions are summed over the networks, and only pairs of vertices in the same network count (ergm’s gof also counts the pairs in different networks, as unreachable).

With missing dyads, the “observed” distributions are averages over nsim networks drawn from the model conditional on the observed dyads, rather than those of the network with missing dyads as non-ties, which would make the model look like it overestimates every count of ties.

Returns:

GofResult