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’sgofN().Simulates
nsimcombined 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, andvar_obstheir 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 (
strorterms, 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 indicesorstr, optional) – The networks to report: as N()’ssubset, 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 thannsimsuggests.)
- Returns:
GofNResult– Index it by statistic for a table of the networks; print itssummary(), orplot()the residuals.