Code for "Spectral goodness of fit for network models"

In the paper, we introduce a new statistic, ’spectral goodness of fit’ (SGOF) to measure how well a network model explains the structure of an observed network. SGOF provides an absolute measure of fit, analogous to the standard R^2 in linear regression. Additionally, as it takes advantage of the properties of the spectrum of the graph Laplacian, it is suitable for comparing network models of diverse functional forms, including both fitted statistical models and algorithmic generative models of networks. After introducing, defining, and providing guidance for interpreting SGOF, we illustrate the properties of the statistic with a number of examples and comparisons to existing techniques. We show that such a spectral approach to assessing model fit fills gaps left by earlier methods and can be widely applied.
As a companion to the above-abstracted paper, we are providing the code to conduct the SGOF analysis and visualize the results as an R package. Please note that the package is subject to change and updating, so please check back here for new versions of code. Eventually, we intend to distribute the package via CRAN, at which point keeping track of updates will be easier for the user of this code.
Please submit error reports and other suggestions to At the moment this is only available for R. Please also feel free to contribute code for other platforms.
The package source is here: spectralGOF_1.0.tar.gz

A quick step-by-step walkthrough is here: spectralGOFwalkthrough.pdf

The functions (without the help pages that are included in the package) are here: spectralGOF.R

Change log
  • 1/5/2016: Updated files and walkthrough posted
  • 7/24/2014: first version of code posted.