Goodness-of-fit diagnostics for ERGMs, TERGMs, SAOMs, and logit models
Assess goodness of fit of btergm
and other network models.
gof(object, ...) createGOF( simulations, target, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), parallel = "no", ncpus = 1, cl = NULL, verbose = TRUE, ... ) ## S4 method for signature 'btergm' gof( object, target = NULL, formula = getformula(object), nsim = 100, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... ) ## S4 method for signature 'ergm' gof( object, target = NULL, formula = getformula(object), nsim = 100, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... ) ## S4 method for signature 'mtergm' gof( object, target = NULL, formula = getformula(object), nsim = 100, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... ) ## S4 method for signature 'tbergm' gof( object, target = NULL, formula = getformula(object), nsim = 100, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... ) ## S4 method for signature 'sienaFit' gof( object, period = NULL, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, structzero = 10, statistics = c(esp, deg, ideg, geodesic, rocpr, walktrap.modularity), groupName = object$f$groupNames[[1]], varName = NULL, outofsample = FALSE, sienaData = NULL, sienaEffects = NULL, nsim = NULL, verbose = TRUE, ... ) ## S4 method for signature 'network' gof( object, covariates, coef, target = NULL, nsim = 100, mcmc = FALSE, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... ) ## S4 method for signature 'matrix' gof( object, covariates, coef, target = NULL, nsim = 100, mcmc = FALSE, MCMC.interval = 1000, MCMC.burnin = 10000, parallel = c("no", "multicore", "snow"), ncpus = 1, cl = NULL, statistics = c(dsp, esp, deg, ideg, geodesic, rocpr, walktrap.modularity), verbose = TRUE, ... )
object |
A |
... |
Arbitrary further arguments to be passed on to the statistics. See also the help page for the gof-statistics. |
simulations |
A list of |
target |
In the |
statistics |
A list of functions used for comparison of observed and simulated networks. Note that the list should contain the actual functions, not a character representation of them. See gof-statistics for details. |
parallel |
Use multiple cores in a computer or nodes in a cluster to
speed up the simulations. The default value |
ncpus |
The number of CPU cores used for parallel GOF assessment (only
if |
cl |
An optional parallel or snow cluster for use if
|
verbose |
Print details? |
formula |
A model formula from which networks are simulated for
comparison. By default, the formula from the |
nsim |
The number of networks to be simulated at each time step.
Example: If there are six time steps in the |
MCMC.interval |
Internally, this package uses the simulation facilities
of the ergm package to create new networks against which to compare
the original network(s) for goodness-of-fit assessment. This argument sets
the MCMC interval to be passed over to the simulation command. The default
value is |
MCMC.burnin |
Internally, this package uses the simulation facilities of
the ergm package to create new networks against which to compare the
original network(s) for goodness-of-fit assessment. This argument sets the
MCMC burnin to be passed over to the simulation command. The default value
is |
period |
Which transition between time periods should be used for GOF
assessment? By default, all transitions between all time periods are used.
For example, if there are three consecutive networks, this will extract
simulations from the transitions between 1 and 2 and between 2 and 3,
respectively, and these simulations will be compared to the networks at
time steps 2 and 3, respectively. The time period can be provided as a
numeric, e.g., |
structzero |
Which value was used for structural zeros (usually nodes
that have dropped out of the network or have not yet joined the network) in
the dependent variable/network? These nodes are removed from the observed
network and the simulations before comparison. Usually, the value |
groupName |
The group name used in the Siena model. |
varName |
The variable name that denotes the dependent networks in the Siena model. |
outofsample |
Should out-of-sample prediction be attempted? If so, some
additional arguments must be provided: |
sienaData |
An object of the class |
sienaEffects |
An object of the class |
covariates |
A list of matrices or network objects that serve as
covariates for the dependent network. The covariates in this list are
automatically added to the formula as |
coef |
A vector of coefficients. |
mcmc |
Should statnet's MCMC methods be used for simulating new
networks? If |
The generic gof
function provides goodness-of-fit measures and
degeneracy checks for btergm
, mtergm
, tbergm
,
ergm
, sienaFit
, and custom dyadic-independent models. The user
can provide a list of network statistics for comparing simulated networks
based on the estimated model with the observed network(s). See
gof-statistics
. The objects created by these methods can be
displayed using various plot and print methods (see gof-plot
).
In-sample GOF assessment is the default, which means that the same time steps
are used for creating simulations and for comparison with the observed
network(s). It is possible to do out-of-sample prediction by specifying a
(list of) target network(s) using the target
argument. If a formula is
provided, the simulations are based on the networks and covariates specified
in the formula. This is helpful in situations where complex out-of-sample
predictions have to be evaluated. A usage scenario could be to simulate from
a network at time t
(provided through the formula
argument) and
compare to an observed network at time t + 1
(the target
argument). This can be done, for example, to assess predictive performance
between time steps of the original networks, or to check whether the model
performs well with regard to a newly measured network given the old data from
the previous time step.
Predictive fit can also be assessed for stochastic actor-oriented models
(SAOM) as implemented in the RSiena package. After compiling the usual
objects (model, data, effects), one of the time steps can be predicted based
on the previous time step and the SAOM using the sienaFit
method of
the gof
function. By default, however, within-sample fit is used for
SAOMs, just like for (T)ERGMs.
The gof
methods for networks and matrices serve to assess the goodness
of fit of a dyadic-independence model. To do this, the method requires a
vector of coefficients (one coefficient for the intercept or edges
term and one coefficient for each covariate), a list of covariates (in matrix
or network shape), and a dependent network or matrix. This is useful for
assessing the goodness of fit of QAP-adjusted logistic regression models (as
implemented in the netlogit
function in the sna package) or
other dyadic-independence models, such as models fitted using glm
.
Note that this method only works with cross-sectional models and does not
accept lists of networks as input data.
The createGOF
function is used internally by the gof
function
in order to create a gof
object from a list of simulated networks and
a list of target networks to compare against. It can also be used directly by
the end user if the user wants to supply lists of simulated and target
networks from other sources.
Leifeld, Philip, Skyler J. Cranmer and Bruce A. Desmarais (2018): 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.
Leifeld, Philip and Skyler J. Cranmer (2019): A Theoretical and Empirical Comparison of the Temporal Exponential Random Graph Model and the Stochastic Actor-Oriented Model. Network Science 7(1): 20–51. doi: 10.1017/nws.2018.26.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.