ergmito_gof {ergmito}R Documentation

Goodness of Fit diagnostics for ERGMito models

Description

Goodness of Fit diagnostics for ERGMito models

Usage

gof_ergmito(
  object,
  GOF = NULL,
  GOF_update = NULL,
  probs = c(0.05, 0.95),
  sim_ci = FALSE,
  R = 50000L,
  ncores = 1L,
  ...
)

## S3 method for class 'ergmito_gof'
plot(
  x,
  y = NULL,
  main = NULL,
  sub = NULL,
  tnames = NULL,
  sort_by_ci = FALSE,
  ...
)

Arguments

object

An object of class ergmito.

GOF

Formula. Additional set of parameters to perform the GOF.

GOF_update

Formula. See the section on model updating in ergmito_formulae().

probs

Numeric vector. Quantiles to plot (see details).

sim_ci

Logical scalar. If FALSE, the default, it will compute the quantiles analytically, otherwise it samples from the ERGM distribution.

R

Integer scalar. Number of simulations to generate (passed to sample). This is only used if sim_ci = TRUE.

ncores

Integer scalar. Number of cores to use for parallel computations (currently ignored).

...

Further arguments passed to stats::quantile.

x

An object of class ergmito_gof.

y

Ignored.

main, sub

Title and subtitle of the plot (see graphics::title).

tnames

A named character vector. Alternative names for the terms.

sort_by_ci

Logical scalar. When TRUE it will sort the x-axis by the with of the CI in for the first parameter of the model.

Details

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:

  1. Calculate the probability of observing each possible graph in its support using the fitted model.

  2. 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.

Value

An object of class ergmito_gof. This is a list with the following components:

Examples

# 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)

[Package ergmito version 0.3-1 Index]