Skip to contents

Overview

srm is an R package for decomposing network data using the Social Relations Model (SRM). It partitions variation in directed networks into three components: actor effects (sender tendencies), partner effects (receiver tendencies), and unique dyadic effects (relationship-specific deviations). It also estimates covariance structures that capture reciprocity and the correlation between sending and receiving behavior.

Part of the netify ecosystem for network analysis in R.

Installation

# install.packages("devtools")
devtools::install_github("netify-dev/srm")

Quick Start

library(srm)

# Decompose a directed friendship network
data(classroom)
fit = srm(classroom)
fit
Social Relations Model
----------------------------------------
Mode:       unipartite
Actors:     12
Grand mean: 3.5077

Variance Decomposition:
  Actor          1.4000  ( 42.3%)
  Partner        0.8539  ( 25.8%)
  Unique         1.0546  ( 31.9%)
  Relationship   0.6885  (cov)
  Actor-Partner  -0.2525  (cov)

Actor effects explain 42% of the variation — individual sending tendencies (generosity vs. selectivity) are the dominant source of variation. The positive relationship covariance indicates reciprocity; the negative actor-partner covariance means generous raters are not necessarily rated highly in return.

Visualize

# Variance partition
plot(fit, type = "variance")

# Actor and partner effects
plot(fit, type = "actor")
plot(fit, type = "partner")

# Dyadic heatmap
plot(fit, type = "dyadic", n = 6)

Test significance

pt = permute_srm(fit, n_perms = 500, seed = 6886)
print(pt)
plot(pt)

Longitudinal analysis

data(trade_net)
fit_long = srm(trade_net)

# Stability of positions over time
srm_stability(fit_long, type = "actor")

# Track specific countries
srm_trend_plot(fit_long, type = "actor", n = 4)

Bipartite (two-mode) networks

data(small_council)
fit_bip = srm(small_council)
summary(fit_bip)

Works with netify objects

library(netify)
data(atop_EA)

net = netify::netify(
  input = atop_EA,
  actor1 = "country1",
  actor2 = "country2",
  symmetric = TRUE,
  sum_dyads = TRUE,
  diag_to_NA = TRUE,
  missing_to_zero = TRUE
)

fit = srm(net)
summary(fit)

Key Functions

Task Function Description
Fit SRM srm() Decompose a network into actor, partner, and unique effects
Extract effects srm_effects() Get actor, partner, or unique effect matrices
Variance components srm_stats() Compute specific variance/covariance statistics
Visualize plot() Actor/partner bar plots, dyadic heatmaps, variance partitions
Permutation test permute_srm() Test significance of variance components
Longitudinal trends srm_trends() Extract effects as tidy data across time points
Trend plots srm_trend_plot() Visualize effect trajectories over time
Stability srm_stability() Inter-temporal correlations of effects
Simulate sim_srm() Generate synthetic networks from known SRM parameters

Vignettes

Getting Help

Citation

If you use srm in your research, please cite:

citation("srm")

References

Dorff, Cassy, and Michael D. Ward. (2013). Networks, Dyads, and the Social Relations Model. Political Science Research Methods 1(2):159-178.

Dorff, Cassy, and Shahryar Minhas. (2017). When Do States Say Uncle? Network Dependence and Sanction Compliance. International Interactions 43(4):563-588.

Contributors

  • Cassy Dorff (Vanderbilt University)
  • Shahryar Minhas (Michigan State University)
  • Tosin Salau (Michigan State University)

This work is supported by National Science Foundation Awards #2017162 and #2017180.