Goodness of Fit diagnostics for ERGMito models
gof_ergmito(
object,
GOF = NULL,
GOF_update = NULL,
probs = c(0.05, 0.95),
sim_ci = FALSE,
R = 50000L,
ncores = 1L,
...
)# S3 method for ergmito_gof
plot(
x,
y = NULL,
main = NULL,
sub = NULL,
tnames = NULL,
sort_by_ci = FALSE,
...
)
An object of class ergmito_gof
. This is a list with the following
components:
ci
A list of matrices of length nnets(object)
with the corresponding
confidence intervals for the statistics of the model.
target_stats
A matrix of the target statistics.
ergmito.probs
A list of numeric vectors of length nnets(object)
with the
probabilities associated to each possible structure of network.
probs
The value passed via probs
.
model
The fitted model.
term_names
Character vector. Names of the terms used in the model.
quantile.args
A list of the values passed via ...
.
An object of class ergmito.
Formula. Additional set of parameters to perform the GOF.
Formula. See the section on model updating in ergmito_formulae()
.
Numeric vector. Quantiles to plot (see details).
Logical scalar. If FALSE
, the default, it will compute the
quantiles analytically, otherwise it samples from the ERGM distribution.
Integer scalar. Number of simulations to generate (passed to sample).
This is only used if sim_ci = TRUE
.
Integer scalar. Number of cores to use for parallel computations (currently ignored).
Further arguments passed to stats::quantile.
An object of class ergmito_gof
.
Ignored.
Title and subtitle of the plot (see graphics::title).
A named character vector. Alternative names for the terms.
Logical scalar. When TRUE
it will sort the x-axis by the
with of the CI in for the first parameter of the model.
The Goodness of Fit function uses the fitted ERGMito to calculate a given confidence interval for a set of sufficient statistics. By default (and currently the only available option), this is done on the sufficient statistics specified in the model.
In detail, the algorithm is executed as follow:
For every network in the list of networks do:
Calculate the probability of observing each possible graph in its support using the fitted model.
If sim_ci = TRUE
, draw R
samples from each set of parameters using the
probabilities computed. Then using the quantile
function, calculate the desired
quantiles of the sufficient statistics. Otherwise, compute the quantiles using
the analytic quantiles using the full distribution.'
The plot method is particularly convenient since it graphically shows whether the target statistics of the model (observed statistics) fall within the simulated range.
The print method tries to copy (explicitly) the print method of the
gof
function from the ergm
R package.
# Fitting the fivenets model
data(fivenets, package = "ergmito")
fit <- ergmito(fivenets ~ edges + nodematch("female"))
# Calculating the gof
ans <- gof_ergmito(fit)
# Looking at the results
ans
plot(ans)
Run the code above in your browser using DataLab