Learn R Programming

ergm (version 3.1.3)

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

Description

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

Usage

## S3 method for class 'default':
gof(object,\dots)
## S3 method for class 'formula':
gof(object, 
                      \dots, 
                      coef=NULL,
                      GOF=NULL,
                      constraints=~.,
                      control=control.gof.formula(),
                      verbose=FALSE)
## S3 method for class 'ergm':
gof(object, 
                   \dots,
                   coef=NULL, 
                   GOF=NULL,
                   constraints=NULL,
                   control=control.gof.ergm(),
                   verbose=FALSE)

Arguments

object
an Robject. Either a formula or an ergm object. See documentation for ergm.
...
Additional arguments, to be passed to lower-level functions in the future.
coef
When given either a formula or an object of class ergm, coef are the parameters from which the sample is drawn. By default set to a vector of 0.
GOF
formula; an Rformula object, of the form ~ 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 typic
constraints
A one-sided formula specifying one or more constraints on the support of the distribution of the networks being modeled. See the help for similarly-named argument in ergm for more information. For
control
A list to control parameters, constructed using control.gof.formula or control.gof.ergm (which have different defaults).
verbose
Provide verbose information on the progress of the simulation.

Value

Details

A sample of graphs is randomly drawn from the specified model. The first argument is typically the output of a call to ergm and the model used for that call is the one fit.

A plot of the summary measures is plotted. More information can be found by looking at the documentation of ergm. For gof.ergm and gof.formula, default behavior depends on the directedness of the network involved; if undirected then degree, espartners, and distance are used as default properties to examine. If the network in question is directed, degree in the above is replaced by idegree and odegree.

See Also

ergm, network, simulate.ergm, summary.ergm, plot.gofobject

Examples

Run this code
data(florentine)
gest <- ergm(flomarriage ~ edges + kstar(2))
gest
summary(gest)

# test the gof.ergm function
gofflo <- gof(gest)
gofflo
summary(gofflo)

# Plot all three on the same page
# with nice margins
par(mfrow=c(1,3))
par(oma=c(0.5,2,1,0.5))
plot(gofflo)

# And now the log-odds
plot(gofflo, plotlogodds=TRUE)

# Use the formula version of gof
gofflo2 <-gof(flomarriage ~ edges + kstar(2), coef=c(-1.6339, 0.0049))
plot(gofflo2)

Run the code above in your browser using DataLab