gof.ergmm {latentnetHRT}R Documentation

Conduct Goodness-of-Fit Diagnostics on a Latent Position or Latent Cluster Position Model

Description

gof computes and plots posterior predictive checks for various networks statistics (e.g., degree, and reachability) to diagnose the goodness-of-fit of Latent Position or Latent Cluster Position models. See ergmm for more information on these models.

Usage

## Default S3 method:
gof(object,...)
## S3 method for class 'ergmm':
gof(object, ...,
         nsim=100,
         GOF=~degree+espartners,
         verbose=FALSE)

Arguments

object an ergmm object. See documentation for ergmm.
nsim The number of posterior draws to use for the posterior predictive checks. This is the size of the sample of networks to be randomly drawn from the posterior distribution specified by the object.
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"), 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.

Details

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

A plot of the summary measures is plotted.

Value

gof, gof.ergmm, and gof.formula return an object of class gofobject. This is a list of the tables of statistics and posterior ``p-values". This is typically plotted using plot.gofobject.

See Also

ergmm, network, rergm, summary.ergmm, plot.gofobject

Examples

## Not run: 
#
# Using Sampson's Monk data, lets fit a 
# simple latent position model
#
data(sampson)
#
# Get the group labels
#
group <- get.vertex.attribute(samplike,"group")
samp.labs <- substr(group,1,1)
#
# Fit the two-dimensional latent social space model 
#
# This may take a few minutes ...
#
samp.fit <- ergmm(samplike ~ latent(k=2), burnin=10000,
                  MCMCsamplesize=2000, interval=30)
#
# Posterior Predictive Checks
gofsamplike <- gof.ergmm(samp.fit, GOF=~idegree)
gofsamplike
#
# Place both on the same page
# with nice margins
#
par(mfrow=c(1,2))
par(oma=c(0.5,2,1,0.5))
#
plot(gofsamplike)
#
# And now the odds 
#
plot(gofsamplike, plotodds=TRUE)
#
# Using Sampson's Monk data, lets 
# fit the two-dimensional clustered latent social space model 
#
# The ngroups parameter fits 3 groups
#
# This may take a few minutes ...
#
samp.fit <- ergmm(samplike ~ latentcluster(k=2, ngroups=3), burnin=10000,
                  MCMCsamplesize=2000, interval=30)
#
# Posterior Predictive Checks
gofsamplike <- gof.ergmm(samp.fit, GOF=~idegree)
gofsamplike
#
plot(gofsamplike)
#
# And now the odds 
#
plot(gofsamplike, plotodds=TRUE)
## End(Not run)

[Package latentnetHRT version 0.7-18 Index]