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.## S3 method for class 'default':
gof(object,\dots)
## S3 method for class 'formula':
gof(formula, \dots, theta0=NULL,
nsim=100, burnin=10000, interval=1000,
GOF=~degree+espartners+distance,
constraints=~.,
control=control.gof.formula(),
seed=NULL,
verbose=FALSE)
## S3 method for class 'ergm':
gof(object, \dots,
nsim=100,
GOF=~degree+espartners+distance,
burnin=10000, interval=1000,
constraints=NULL,
control=control.gof.ergm(),
seed=NULL,
theta0=NULL, verbose=FALSE)y ~ ,
where y is a network object or a matrix that can be
coerced to a network object. This specifies the model to simulate from.
For the details on the possible
~ 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 typicallyergm for more information. For
control.gof.formula or control.gof.ergm
(which have different defaults).NULL to
use whatever the state of the random number generater is at the time
of the call.gof, gof.ergm, and gof.formula
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.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.
data(florentine)
gest <- ergm(flomarriage ~ edges + kstar(2))
gest
summary(gest)
# test the gof.ergm function
gofflo <- gof(gest)
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), theta0=c(-1.6339, 0.0049))
plot(gofflo2)Run the code above in your browser using DataLab