Learn R Programming

latentnet (version 2.7.1)

gof: Conduct Goodness-of-Fit Diagnostics on a Exponential Family Random Graph Mixed Model Fit

Description

gof calculates \(p\)-values for geodesic distance, degree, and reachability summaries to diagnose the goodness-of-fit of exponential family random graph mixed models. See ergmm for more information on these models.

Usage

# S3 method for ergmm
gof(object, …,
         nsim=100,
         GOF=~idegree+odegree+distance,
         verbose=FALSE)

Arguments

object

an ergmm object (returned by ergmm).

nsim

The number of simulations to use for the MCMC \(p\)-values. This is the size of the sample of graphs to be randomly drawn from the distribution specified by the object on the set of all graphs.

GOF

formula; an R formula object, of the form ~ <model terms> specifying the statistics to use to diagnosis the goodness-of-fit of the model. They do not need to be in the model formula specified in formula, and typically are not. Examples are the degree distribution ("degree"), minimum geodesic distances ("dist"), and shared partner distributions ("espartners" and "dspartners"). For the details on the possible <model terms>, see ergm-terms.

verbose

Provide verbose information on the progress of the simulation.

Additional arguments, to be passed to lower-level functions in the future.

Value

gof and gof.ergmm return an object of class gofobject. This is a list of the tables of statistics and \(p\)-values. This is typically plotted using plot.gofobject.

Details

A sample of graphs is randomly drawn from the posterior of the ergmm.

A plot of the summary measures is plotted. More information can be found by looking at the documentation of ergm.

See Also

ergmm, ergmm (object), ergm, network, simulate.ergmm, plot.gofobject

Examples

Run this code
# NOT RUN {
#
data(sampson)
#
# test the gof.ergm function
#
samplike.fit <- ergmm(samplike ~ euclidean(d=2,G=3),
                      control=ergmm.control(burnin=1000,interval=5))
samplike.fit
summary(samplike.fit)

#
# Plot the probabilities first
#
monks.gof <- gof(samplike.fit)
monks.gof
#
# Place all three on the same page
# with nice margins
#
par(mfrow=c(1,3))
par(oma=c(0.5,2,1,0.5))
#
plot(monks.gof)
#
# And now the odds 
#
plot(monks.gof, plotlogodds=TRUE)
# }

Run the code above in your browser using DataLab