ergmx.gofN#

ergmx.gofN(fit, GOF=None, *, subset=True, nsim=100, seed=None, interval=None, burnin=None, n_chains=None, triadic_weight=None)[source]#

Goodness of fit network by network, for a model of several networks (ergmx.Networks(), ergmx.NetSeries()), as ergm.multi’s gofN().

Simulates nsim combined networks from the fit, and compares each network’s observed statistics with the mean (fitted) and variance (var) of its simulated ones, as Pearson residuals: (observed - fitted) / sqrt(var - var_obs). With missing dyads, the observed statistics are the mean of networks simulated conditional on the observed dyads, and var_obs their variance (0 otherwise). Statistics that don’t vary in a network’s simulations are NaN there.

Parameters:
  • fit (ErgmFit) – A model of several networks.

  • GOF (str or terms, optional) – The statistics to check, as a formula, evaluated on each network: by default the model’s, each network’s share of the model’s statistics (offset() terms included). A term outside N() is N(~term).

  • subset (bool array, 1-based indices or str, optional) – The networks to report: as N()’s subset, logical values, indices or an R expression of the networks’ attributes ("~n >= 4").

  • nsim – As in ergmx.gof().

  • seed – As in ergmx.gof().

  • burnin – As in ergmx.gof().

  • n_chains – As in ergmx.gof().

  • triadic_weight – As in ergmx.gof().

  • interval (int, optional) – MCMC proposals between simulated networks: by default three times the number of dyads (at least the fit’s interval), so that each network’s simulated statistics are nearly independent. (ergm.multi uses the fit’s, 1024 by default, which leaves those of many small networks autocorrelated, and their fitted values and residuals noisier than nsim suggests.)

Returns:

GofNResult – Index it by statistic for a table of the networks; print its summary(), or plot() the residuals.