Social Network Analysis in R
R
POL 491
Network Analysis
This set of pages contains code and examples for doing social network analysis in R. The code was pulled from quarto slides, so there are a lot of headers. Use the Table of Contents on the right to navigate within a page. The beginning of each section indicates what packages are being used. In general the following packages are used:
- igraph: To do most of the network work here.
- ggraph: To visualize the networks.
- smacof: For MDS scaling.
- ca: For correspondence analysis.
- blockmodeling: For blockmodeling and structural equivalence.
- sna: A few random things that igraph cannot do and QAP.
- ergm: For ERGMs.
- ggplot2: Used throughout for visualizations.
- permuco: Used for an easy way to do permutation tests with regression.
- intergraph: Used to translate between igraph and network objects.
The course this was written for followed Analyzing Social Networks in R but did not make use of the xUCINET package as it appears to be no longer maintained (it is not on CRAN).
Contents
| Page | Description |
|---|---|
| Using igraph | Creating igraph objects from matrices and edgelists, setting attributes, and basic graph manipulation. |
| Visualizing Networks | Plotting networks with ggraph, including layouts, nodes, edges, and adding labels. |
| Network Centrality | Calculating degree, betweenness, closeness, and eigenvector centrality on the Ohio legislative network. |
| Whole Network Statistics | Density, transitivity, reciprocity, diameter, and other whole-network measures. |
| Clusters | Finding cliques, implementing cluster methods, and analyzing cluster overlaps. |
| Structural Similarity and Blockmodeling | Structural equivalence, dyad-level comparisons, and creating blockmodels. |
| Bipartite Networks | Loading, projecting, and visualizing two-mode (bipartite) networks. |
| Scaling and Visualization | MDS scaling, correspondence analysis, and hierarchical clustering for network visualization. |
| Quadratic Assignment Procedure (QAP) | Running QAP regression and correlation on dyadic network data. |
| Exponential Random Graph Models (ERGM) | Building and interpreting ERGMs with the ergm package. |