This tutorial is a joint product of the Statnet Development Team:

Pavel N. Krivitsky (University of New South Wales)
Martina Morris (University of Washington)
Mark S. Handcock (University of California, Los Angeles)
Carter T. Butts (University of California, Irvine)
David R. Hunter (Penn State University)
Steven M. Goodreau (University of Washington)
Chad Klumb (University of Washington)
Skye Bender de-Moll (Oakland, CA)

The software demonstrated in this tutorial is authored by Emily Beylerian and Martina Morris.


0.1 The statnet Project

All statnet packages are open-source, written for the R computing environment, and published on CRAN. The source repositories are hosted on GitHub. Our website is statnet.org

  • Need help? For general questions and comments, please email the statnet users group at statnet_help@uw.edu. You’ll need to join the listserv if you’re not already a member. You can do that here: statnet_help listserve.

  • Found a bug in our software? Please let us know by filing an issue in the appropriate package GitHub repository, with a reproducible example.

  • Want to request new functionality? We welcome suggestions – you can make a request by filing an issue on the appropriate package GitHub repository. The chances that this functionality will be developed are substantially improved if the requests are accompanied by some proposed code (we are happy to review pull requests).

  • For all other issues, please email us at contact@statnet.org.


1 Introduction

This workshop and tutorial provide an introduction to using the statnetWeb Shiny app for network analysis with statnet. These online materials have been designed for both formal workshops and self-study, with many examples to provide hands-on experience with the software, and self-contained data.

With statnetWeb you can:

  • Load and edit network data from R, Excel or Pajek
  • Look at plots and summaries of descriptive statistics
  • Compare the observed network with simple null models
  • Fit ERGMs to the observed network
  • Diagnose the model specification and goodness-of-fit
  • Simulate from models
  • Customize and download plots and summaries for later use

1.1 What is R?

R (R Core Team 2021) is a free software environment for statistical computing and graphics. It runs on a wide variety of UNIX platforms, Windows and MacOS. It is designed to provide a platform for others to contribute “packages” – software that performs specific types of statistical analysis, visualization, and application building.

1.2 What is a Shiny app?

Shiny is an R package that allows developers to create applications for users that run in a web browser and provide a simple point-and-click interface to the functionality of other R packages. For examples, you can take a look at the apps hosted on the Shiny Gallery. A really simple example is this K-means clustering app. Instead of the user having to code up the R script to run and plot the k-mean clustering of the data, they just need to point and click the controls on the left side of the screen. Another Shiny app that has some nice network vizualizations is the CRAN explorer (you’ll need to page down to the interactive part about 3 pages down).

Shiny apps provide a simple way for non-technical users to interact with data, using R packages in the background without having to learn coding. While most Shiny apps are designed to be used to explore a particular dataset on a website, we designed statnetWeb instead as a pedagogical tool for learning how to analyze network data.

1.3 What is statnet?

statnet (Krivitsky et al. 2003-2020; Handcock et al. 2008) is a suite of R packages for the management, exploration, statistical analysis, simulation and visualization of network data. The statistical modeling framework relies on Exponential-family Random Graph Models (ERGMs). All of the software is open source (GPL-3), with development on GitHub, and packages published to the Comprehensive R Archive Network (CRAN).

1.4 What is statnetWeb?

statnetWeb is an R Shiny app for network data analysis that gives a user access to the functionality of three statnet packages:

  • network (Butts 2008, 2021) – storage and manipulation of network data

  • sna (Butts 2020) – descriptive statistics and graphics for exploratory network analysis`

  • ergm (Handcock et al. 2022) – statistical modeling of networks using Exponential-family Random Graph Models

This set of packages from the statnet suite is designed for static (or “cross-sectional”) network analysis. While the models that can be specified in ergm include some types of continuously valued ties, this workshop focuses on simple binary tie networks (0,1).

1.5 Prerequisites

None. This is a very basic introductory workshop.

1.6 Software installation

There are two ways to run statnetWeb, both of which are covered in the tutorial:

  • via an online portal, in which case no software installation of any kind is required, one only needs an internet connection.

  • by launching the package statnetWeb from the R command line. This will pop up a browser window on your local machine, giving you the same experience as the online portal, but the session will be running on your local machine rather than the cloud. In this case, it is necessary to install:

    • the latest version of R (available here).

    • the statnetWeb package, which can be installed from the R command line with the following expression:

install.packages("statnetWeb")

Installing statnetWeb will automatically install the three required packages from the statnet suite that will be running in the background while you are using the app. Information about installing additional packages from the Statnet suite can be found on the statnet workshop wiki.

Finally, our workshops are generally conducted using the free version of RStudio (available here). Since this particular workshop runs in a browser window, you won’t interact much with the R program directly, so it will have little impact on your experience here. But we recommend it as a very useful environment for running R.

2 Tutorial

Since this workshop is entirely interactive, there is no code to run, and the instructions for the guided interactive session are included in pdf format

statnetWeb.pdf.

You can save the tutorial from the browser window.

Appendix

Session info
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.1 (2022-06-23 ucrt)
 os       Windows 10 x64 (build 19044)
 system   x86_64, mingw32
 ui       RTerm
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/Los_Angeles
 date     2022-06-27
 pandoc   2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown)

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 bslib         0.3.1   2021-10-06 [1] CRAN (R 4.2.0)
 cli           3.3.0   2022-04-25 [1] CRAN (R 4.2.0)
 digest        0.6.29  2021-12-01 [1] CRAN (R 4.2.0)
 evaluate      0.15    2022-02-18 [1] CRAN (R 4.2.0)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.2.0)
 htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.2.0)
 jquerylib     0.1.4   2021-04-26 [1] CRAN (R 4.2.0)
 jsonlite      1.8.0   2022-02-22 [1] CRAN (R 4.2.0)
 knitr       * 1.39    2022-04-26 [1] CRAN (R 4.2.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.0)
 rlang         1.0.2   2022-03-04 [1] CRAN (R 4.2.0)
 rmarkdown     2.14    2022-04-25 [1] CRAN (R 4.2.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.2.0)
 sass          0.4.1   2022-03-23 [1] CRAN (R 4.2.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
 stringi       1.7.6   2021-11-29 [1] CRAN (R 4.2.0)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 4.2.0)
 xfun          0.31    2022-05-10 [1] CRAN (R 4.2.0)
 yaml          2.3.5   2022-02-21 [1] CRAN (R 4.2.0)

 [1] C:/Users/Martina Morris/AppData/Local/R/win-library/4.2
 [2] C:/Program Files/R/R-4.2.1/library

──────────────────────────────────────────────────────────────────────────────

References

Butts, Carter T. 2008. “Network: A Package for Managing Relational Data in R.” Journal of Statistical Software 24 (2). https://www.jstatsoft.org/v24/i02/paper.
———. 2020. Sna: Tools for Social Network Analysis. https://CRAN.R-project.org/package=sna.
———. 2021. Network: Classes for Relational Data. The Statnet Project (https://statnet.org). https://CRAN.R-project.org/package=network.
Handcock, Mark S., David R. Hunter, Carter T. Butts, Steven M. Goodreau, Pavel N. Krivitsky (maintainer), Martina Morris, Chad Klumb, Michał Bojanowski, and other contributors. 2022. Ergm: Fit, Simulate and Diagnose Exponential-Family Models for Networks. https://CRAN.R-project.org/package=ergm.
Handcock, Mark S., David R. Hunter, Carter T. Butts, Steven M. Goodreau, and Martina Morris. 2008. “Statnet: Software Tools for the Representation, Visualization, Analysis and Simulation of Network Data.” Journal of Statistical Software 24 (1-9). https://www.jstatsoft.org/v24/.
Krivitsky, Pavel N., Mark S. Handcock, David R. Hunter, Carter T. Butts, Chad Klumb, Steven M. Goodreau, and Martina Morris. 2003-2020. Statnet: Software Tools for the Statistical Modeling of Network Data. Statnet Development Team. http://statnet.org.
R Core Team. 2021. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.