This vignette provides a definition of the full, active, active_saturated, and manual risk sets, explains how each is specified in remify::remify(), and shows how the processed risk set is represented in the returned remify object.


Consider a small example network:

library(remify) # loading package
data(randomREHsmall) # data

# processing the edgelist 
reh <- remify(
  edgelist = randomREHsmall$edgelist,
  directed = TRUE,
  ordinal  = FALSE,
  model    = "tie",
  actors   = randomREHsmall$actors,
  origin   = randomREHsmall$origin
)

Definition of risk set

A relational event history consists of a time-ordered sequence of (directed or undirected) interactions. For each event, we know:

  • its time of occurrence, either as a timestamp/date/continuous value or as an order index
  • the actors involved
  • the type of the event (if measured)

For instance, the first five events of the randomREHsmall sequence are:

randomREHsmall$edgelist[1:5,]
##                  time  actor1 actor2
## 1 2020-03-05 16:36:37  Colton  Kayla
## 2 2020-03-05 19:34:11    Lexy Colton
## 3 2020-03-05 20:49:37  Colton  Kayla
## 4 2020-03-05 21:38:23  Colton  Kayla
## 5 2020-03-06 06:54:12 Richard Colton

where time, actor1, actor2 describe each observed event (in this example, event types are not annotated).

When modeling a relational event sequence, we define per each time point a risk set: the set of dyadic events that were at risk of occurring at that time point (which always includes the event that actually occurred). The risk set is a central building block of the likelihood for both tie-oriented and actor-oriented models. Four possible definitions are discussed below: full, active, active_saturated, and manual.


The full risk set

The full risk set assumes all possible dyads are at risk throughout the entire observation period. For a network with \(N\) actors, \(C\) event types, and directed events, the risk set has size \(D = N(N-1)C\); for undirected events, \(D = N(N-1)C/2\).

In randomREHsmall, dyads are directed, \(N = 5\) actors, and \(C = 1\) (untyped), so \(D = 5 \times 4 \times 1 = 20\).

The risk set dyad composition is stored in reh$index$dyad_map:

head(reh$index$dyad_map)
##   dyadID    actor1    actor2
## 1      1    Colton Francesca
## 2      2    Colton     Kayla
## 3      3    Colton      Lexy
## 4      4    Colton   Richard
## 5      5 Francesca    Colton
## 6      6 Francesca     Kayla

The ID of each dyad is defined by a two-step approach:

Step 1. Actors’ names are sorted alphanumerically and assigned integer IDs from \(1\) to \(N\):

sorted_actors <- sort(randomREHsmall$actors)
sorted_actors
## [1] "Colton"    "Francesca" "Kayla"     "Lexy"      "Richard"
N <- length(randomREHsmall$actors)

# IDs are 1 to N
names(sorted_actors) <- 1:N
sorted_actors
##           1           2           3           4           5 
##    "Colton" "Francesca"     "Kayla"      "Lexy"   "Richard"

Step 2. Dyads are indexed by looping first over actor1, then actor2, and finally type (if applicable), skipping self-loops:

sorted_types <- c(" ") # no event type in randomREHsmall
C <- length(sorted_types)

dyad_mat <- matrix(NA, nrow = N*(N-1)*C, ncol = 3)
colnames(dyad_mat) <- c("actor1", "actor2", "type")
rownames(dyad_mat) <- 1:(N*(N-1)*C)

d <- 1
for(type in sorted_types){
  for(actor1 in sorted_actors){
    for(actor2 in sorted_actors){
      if(actor1 != actor2){
        dyad_mat[d,] <- c(actor1, actor2, type)
        d <- d + 1
      }
    }
  }
}

dyad_mat[1:5,]
##   actor1      actor2      type
## 1 "Colton"    "Francesca" " " 
## 2 "Colton"    "Kayla"     " " 
## 3 "Colton"    "Lexy"      " " 
## 4 "Colton"    "Richard"   " " 
## 5 "Francesca" "Colton"    " "
dim(dyad_mat)[1] # full risk set size = 20
## [1] 20

The row index in dyad_mat corresponds to the dyadID. This ID is used throughout ‘remverse’ to identify dyads. For tie-oriented modeling, the observed dyad IDs per event are stored in reh$ids$dyad:

head(reh$ids$dyad) # dyadID of the first few observed events
## [1]  2 13  2  2 17  2

Visualizing the risk set

A useful visualization plots the risk set as a grid with senders on the y-axis and receivers on the x-axis. At each time point, the observed dyad is colored green and all other at-risk dyads are colored gray.

Visualizing risk set composition at each time point

Considering the first four time points of randomREHsmall, we observe: the dyad (Colton, Kayla) at \(t_1\), \(t_3\), and \(t_4\), and the dyad (Lexy, Colton) at \(t_2\). Green cells mark observed events; gray cells mark other at-risk dyads; white cells mark infeasible events (self-loops).

For undirected networks, dyads are sorted alphanumerically before processing, so the risk set is restricted to the lower triangular grid. For instance, c("Lexy", "Colton") becomes c("Colton", "Lexy").

Visualizing full risk set for undirected network

The active, active_saturated, and manual risk set

The full risk set maintains a constant structure throughout the event history: all possible dyads are always at risk. Three alternative definitions accommodate settings where not all dyads are plausibly at risk.


The active risk set

In sparse networks, the number of observed dyads can be far smaller than \(D\). The active risk set restricts the risk set to only those dyads observed at least once in the event history, and maintains this structure throughout. Specify with riskset = "active".

The use of the active risk set can substantially decrease computational time for both statistics and model estimation. However, this reduction excludes dyads that were never observed but might be plausibly at risk. It is good practice to examine the active dyads before proceeding and to consider whether the exclusion of unobserved dyads is defensible for the data at hand.

reh_active <- remify(
  edgelist = randomREHsmall$edgelist,
  directed = TRUE,
  ordinal  = FALSE,
  model    = "tie",
  actors   = randomREHsmall$actors,
  riskset  = "active",
  origin   = randomREHsmall$origin
)

# number of dyads in full vs active risk set
reh_active$D
## [1] 20
reh_active$activeD
## [1] 20
# the active dyads
reh_active$riskset_info$included
##       actor1    actor2 dyadID actor1ID actor2ID
## 1     Colton Francesca      1        1        2
## 2     Colton     Kayla      2        1        3
## 3     Colton      Lexy      3        1        4
## 4     Colton   Richard      4        1        5
## 5  Francesca    Colton      5        2        1
## 6  Francesca     Kayla      6        2        3
## 7  Francesca      Lexy      7        2        4
## 8  Francesca   Richard      8        2        5
## 9      Kayla    Colton      9        3        1
## 10     Kayla Francesca     10        3        2
## 11     Kayla      Lexy     11        3        4
## 12     Kayla   Richard     12        3        5
## 13      Lexy    Colton     13        4        1
## 14      Lexy Francesca     14        4        2
## 15      Lexy     Kayla     15        4        3
## 16      Lexy   Richard     16        4        5
## 17   Richard    Colton     17        5        1
## 18   Richard Francesca     18        5        2
## 19   Richard     Kayla     19        5        3
## 20   Richard      Lexy     20        5        4

The grid visualization below shows the active risk set at time \(t_3\). Only the dyads observed at least once in the history (gray and green tiles) are at risk; all other dyads are excluded (white tiles).

Visualizing active risk set at time t3

The active_saturated risk set

The active_saturated risk set extends the active risk set by additionally including the reverse direction of each observed dyad and all event types for each observed actor pair. For instance, if A→B is observed, B→A is also included in the risk set. This reflects the assumption that observing an interaction between two actors implies that both directions (and all event types) are structurally possible, even if not yet observed. Specify with riskset = "active_saturated".

reh_sat <- remify(
  edgelist = randomREHsmall$edgelist,
  directed = TRUE,
  model    = "tie",
  riskset  = "active_saturated",
  actors   = randomREHsmall$actors,
  origin   = randomREHsmall$origin
)

reh_sat$activeD
## [1] 20
reh_sat$riskset_info$included
##       actor1    actor2 dyadID actor1ID actor2ID
## 1     Colton Francesca      1        1        2
## 2     Colton     Kayla      2        1        3
## 3     Colton      Lexy      3        1        4
## 4     Colton   Richard      4        1        5
## 5  Francesca    Colton      5        2        1
## 6  Francesca     Kayla      6        2        3
## 7  Francesca      Lexy      7        2        4
## 8  Francesca   Richard      8        2        5
## 9      Kayla    Colton      9        3        1
## 10     Kayla Francesca     10        3        2
## 11     Kayla      Lexy     11        3        4
## 12     Kayla   Richard     12        3        5
## 13      Lexy    Colton     13        4        1
## 14      Lexy Francesca     14        4        2
## 15      Lexy     Kayla     15        4        3
## 16      Lexy   Richard     16        4        5
## 17   Richard    Colton     17        5        1
## 18   Richard Francesca     18        5        2
## 19   Richard     Kayla     19        5        3
## 20   Richard      Lexy     20        5        4

The manual risk set

There are settings where only a specific, user-defined set of dyads should be considered at risk throughout the event history. This is the manual risk set, specified via riskset = "manual" and the manual.riskset argument.

manual.riskset is a data.frame with columns actor1 and actor2 (and optionally type) listing all dyads that are at risk. This defines a static risk set that does not vary over time. Any observed dyads from the edgelist that are absent from manual.riskset are added automatically with a warning.

Typical use cases include:

  • Structural constraints: only certain actor pairs can interact (e.g., members of specific organizational units, or actors within each other’s contact list).
  • Sparse networks: the user has domain knowledge about which dyads are plausibly at risk, beyond just those observed.
  • Spatial or group constraints: only actors present in the same location or group can interact.

Specifying a manual risk set

data(randomREH)

# Suppose we want to restrict the risk set to dyads among three actors only,
# while all other dyads are considered structurally impossible.
manual_rs <- data.frame(
  actor1 = c("Alexander", "Alexander", "Colton",    "Colton",    "Lexy",      "Lexy"),
  actor2 = c("Colton",    "Lexy",      "Alexander", "Lexy",      "Alexander", "Colton")
)

reh_manual <- remify(
  edgelist       = randomREH$edgelist,
  directed       = TRUE,
  ordinal        = FALSE,
  model          = "tie",
  actors         = randomREH$actors,
  riskset        = "manual",
  manual.riskset = manual_rs,
  origin         = randomREH$origin
)
## Note: `actors` is ignored when `riskset = "manual"` and `manual.riskset` is used
## Warning in remify(edgelist = randomREH$edgelist, directed = TRUE, ordinal =
## FALSE, : 1112 observed dyad-type combinations were added to the manual risk
## set.
# Active (manual) risk set size
reh_manual$activeD
## [1] 380
# Inspect the decoded risk set
reh_manual$riskset_info$included
##        actor1    actor2 dyadID actor1ID actor2ID
## 1   Alexander    Andrey      1        1        2
## 2   Alexander   Breanna      2        1        3
## 3   Alexander   Charles      3        1        4
## 4   Alexander    Colton      4        1        5
## 5   Alexander   Crystal      5        1        6
## 6   Alexander     Derek      6        1        7
## 7   Alexander Francesca      7        1        8
## 8   Alexander    Justin      8        1        9
## 9   Alexander     Kayla      9        1       10
## 10  Alexander    Kelsey     10        1       11
## 11  Alexander   Kiffani     11        1       12
## 12  Alexander      Lexy     12        1       13
## 13  Alexander      Maya     13        1       14
## 14  Alexander   Mckenna     14        1       15
## 15  Alexander     Megan     15        1       16
## 16  Alexander  Michaela     16        1       17
## 17  Alexander   Richard     17        1       18
## 18  Alexander     Wyatt     18        1       19
## 19  Alexander   Zackary     19        1       20
## 20     Andrey Alexander     20        2        1
## 21     Andrey   Breanna     21        2        3
## 22     Andrey   Charles     22        2        4
## 23     Andrey    Colton     23        2        5
## 24     Andrey   Crystal     24        2        6
## 25     Andrey     Derek     25        2        7
## 26     Andrey Francesca     26        2        8
## 27     Andrey    Justin     27        2        9
## 28     Andrey     Kayla     28        2       10
## 29     Andrey    Kelsey     29        2       11
## 30     Andrey   Kiffani     30        2       12
## 31     Andrey      Lexy     31        2       13
## 32     Andrey      Maya     32        2       14
## 33     Andrey   Mckenna     33        2       15
## 34     Andrey     Megan     34        2       16
## 35     Andrey  Michaela     35        2       17
## 36     Andrey   Richard     36        2       18
## 37     Andrey     Wyatt     37        2       19
## 38     Andrey   Zackary     38        2       20
## 39    Breanna Alexander     39        3        1
## 40    Breanna    Andrey     40        3        2
## 41    Breanna   Charles     41        3        4
## 42    Breanna    Colton     42        3        5
## 43    Breanna   Crystal     43        3        6
## 44    Breanna     Derek     44        3        7
## 45    Breanna Francesca     45        3        8
## 46    Breanna    Justin     46        3        9
## 47    Breanna     Kayla     47        3       10
## 48    Breanna    Kelsey     48        3       11
## 49    Breanna   Kiffani     49        3       12
## 50    Breanna      Lexy     50        3       13
## 51    Breanna      Maya     51        3       14
## 52    Breanna   Mckenna     52        3       15
## 53    Breanna     Megan     53        3       16
## 54    Breanna  Michaela     54        3       17
## 55    Breanna   Richard     55        3       18
## 56    Breanna     Wyatt     56        3       19
## 57    Breanna   Zackary     57        3       20
## 58    Charles Alexander     58        4        1
## 59    Charles    Andrey     59        4        2
## 60    Charles   Breanna     60        4        3
## 61    Charles    Colton     61        4        5
## 62    Charles   Crystal     62        4        6
## 63    Charles     Derek     63        4        7
## 64    Charles Francesca     64        4        8
## 65    Charles    Justin     65        4        9
## 66    Charles     Kayla     66        4       10
## 67    Charles    Kelsey     67        4       11
## 68    Charles   Kiffani     68        4       12
## 69    Charles      Lexy     69        4       13
## 70    Charles      Maya     70        4       14
## 71    Charles   Mckenna     71        4       15
## 72    Charles     Megan     72        4       16
## 73    Charles  Michaela     73        4       17
## 74    Charles   Richard     74        4       18
## 75    Charles     Wyatt     75        4       19
## 76    Charles   Zackary     76        4       20
## 77     Colton Alexander     77        5        1
## 78     Colton    Andrey     78        5        2
## 79     Colton   Breanna     79        5        3
## 80     Colton   Charles     80        5        4
## 81     Colton   Crystal     81        5        6
## 82     Colton     Derek     82        5        7
## 83     Colton Francesca     83        5        8
## 84     Colton    Justin     84        5        9
## 85     Colton     Kayla     85        5       10
## 86     Colton    Kelsey     86        5       11
## 87     Colton   Kiffani     87        5       12
## 88     Colton      Lexy     88        5       13
## 89     Colton      Maya     89        5       14
## 90     Colton   Mckenna     90        5       15
## 91     Colton     Megan     91        5       16
## 92     Colton  Michaela     92        5       17
## 93     Colton   Richard     93        5       18
## 94     Colton     Wyatt     94        5       19
## 95     Colton   Zackary     95        5       20
## 96    Crystal Alexander     96        6        1
## 97    Crystal    Andrey     97        6        2
## 98    Crystal   Breanna     98        6        3
## 99    Crystal   Charles     99        6        4
## 100   Crystal    Colton    100        6        5
## 101   Crystal     Derek    101        6        7
## 102   Crystal Francesca    102        6        8
## 103   Crystal    Justin    103        6        9
## 104   Crystal     Kayla    104        6       10
## 105   Crystal    Kelsey    105        6       11
## 106   Crystal   Kiffani    106        6       12
## 107   Crystal      Lexy    107        6       13
## 108   Crystal      Maya    108        6       14
## 109   Crystal   Mckenna    109        6       15
## 110   Crystal     Megan    110        6       16
## 111   Crystal  Michaela    111        6       17
## 112   Crystal   Richard    112        6       18
## 113   Crystal     Wyatt    113        6       19
## 114   Crystal   Zackary    114        6       20
## 115     Derek Alexander    115        7        1
## 116     Derek    Andrey    116        7        2
## 117     Derek   Breanna    117        7        3
## 118     Derek   Charles    118        7        4
## 119     Derek    Colton    119        7        5
## 120     Derek   Crystal    120        7        6
## 121     Derek Francesca    121        7        8
## 122     Derek    Justin    122        7        9
## 123     Derek     Kayla    123        7       10
## 124     Derek    Kelsey    124        7       11
## 125     Derek   Kiffani    125        7       12
## 126     Derek      Lexy    126        7       13
## 127     Derek      Maya    127        7       14
## 128     Derek   Mckenna    128        7       15
## 129     Derek     Megan    129        7       16
## 130     Derek  Michaela    130        7       17
## 131     Derek   Richard    131        7       18
## 132     Derek     Wyatt    132        7       19
## 133     Derek   Zackary    133        7       20
## 134 Francesca Alexander    134        8        1
## 135 Francesca    Andrey    135        8        2
## 136 Francesca   Breanna    136        8        3
## 137 Francesca   Charles    137        8        4
## 138 Francesca    Colton    138        8        5
## 139 Francesca   Crystal    139        8        6
## 140 Francesca     Derek    140        8        7
## 141 Francesca    Justin    141        8        9
## 142 Francesca     Kayla    142        8       10
## 143 Francesca    Kelsey    143        8       11
## 144 Francesca   Kiffani    144        8       12
## 145 Francesca      Lexy    145        8       13
## 146 Francesca      Maya    146        8       14
## 147 Francesca   Mckenna    147        8       15
## 148 Francesca     Megan    148        8       16
## 149 Francesca  Michaela    149        8       17
## 150 Francesca   Richard    150        8       18
## 151 Francesca     Wyatt    151        8       19
## 152 Francesca   Zackary    152        8       20
## 153    Justin Alexander    153        9        1
## 154    Justin    Andrey    154        9        2
## 155    Justin   Breanna    155        9        3
## 156    Justin   Charles    156        9        4
## 157    Justin    Colton    157        9        5
## 158    Justin   Crystal    158        9        6
## 159    Justin     Derek    159        9        7
## 160    Justin Francesca    160        9        8
## 161    Justin     Kayla    161        9       10
## 162    Justin    Kelsey    162        9       11
## 163    Justin   Kiffani    163        9       12
## 164    Justin      Lexy    164        9       13
## 165    Justin      Maya    165        9       14
## 166    Justin   Mckenna    166        9       15
## 167    Justin     Megan    167        9       16
## 168    Justin  Michaela    168        9       17
## 169    Justin   Richard    169        9       18
## 170    Justin     Wyatt    170        9       19
## 171    Justin   Zackary    171        9       20
## 172     Kayla Alexander    172       10        1
## 173     Kayla    Andrey    173       10        2
## 174     Kayla   Breanna    174       10        3
## 175     Kayla   Charles    175       10        4
## 176     Kayla    Colton    176       10        5
## 177     Kayla   Crystal    177       10        6
## 178     Kayla     Derek    178       10        7
## 179     Kayla Francesca    179       10        8
## 180     Kayla    Justin    180       10        9
## 181     Kayla    Kelsey    181       10       11
## 182     Kayla   Kiffani    182       10       12
## 183     Kayla      Lexy    183       10       13
## 184     Kayla      Maya    184       10       14
## 185     Kayla   Mckenna    185       10       15
## 186     Kayla     Megan    186       10       16
## 187     Kayla  Michaela    187       10       17
## 188     Kayla   Richard    188       10       18
## 189     Kayla     Wyatt    189       10       19
## 190     Kayla   Zackary    190       10       20
## 191    Kelsey Alexander    191       11        1
## 192    Kelsey    Andrey    192       11        2
## 193    Kelsey   Breanna    193       11        3
## 194    Kelsey   Charles    194       11        4
## 195    Kelsey    Colton    195       11        5
## 196    Kelsey   Crystal    196       11        6
## 197    Kelsey     Derek    197       11        7
## 198    Kelsey Francesca    198       11        8
## 199    Kelsey    Justin    199       11        9
## 200    Kelsey     Kayla    200       11       10
## 201    Kelsey   Kiffani    201       11       12
## 202    Kelsey      Lexy    202       11       13
## 203    Kelsey      Maya    203       11       14
## 204    Kelsey   Mckenna    204       11       15
## 205    Kelsey     Megan    205       11       16
## 206    Kelsey  Michaela    206       11       17
## 207    Kelsey   Richard    207       11       18
## 208    Kelsey     Wyatt    208       11       19
## 209    Kelsey   Zackary    209       11       20
## 210   Kiffani Alexander    210       12        1
## 211   Kiffani    Andrey    211       12        2
## 212   Kiffani   Breanna    212       12        3
## 213   Kiffani   Charles    213       12        4
## 214   Kiffani    Colton    214       12        5
## 215   Kiffani   Crystal    215       12        6
## 216   Kiffani     Derek    216       12        7
## 217   Kiffani Francesca    217       12        8
## 218   Kiffani    Justin    218       12        9
## 219   Kiffani     Kayla    219       12       10
## 220   Kiffani    Kelsey    220       12       11
## 221   Kiffani      Lexy    221       12       13
## 222   Kiffani      Maya    222       12       14
## 223   Kiffani   Mckenna    223       12       15
## 224   Kiffani     Megan    224       12       16
## 225   Kiffani  Michaela    225       12       17
## 226   Kiffani   Richard    226       12       18
## 227   Kiffani     Wyatt    227       12       19
## 228   Kiffani   Zackary    228       12       20
## 229      Lexy Alexander    229       13        1
## 230      Lexy    Andrey    230       13        2
## 231      Lexy   Breanna    231       13        3
## 232      Lexy   Charles    232       13        4
## 233      Lexy    Colton    233       13        5
## 234      Lexy   Crystal    234       13        6
## 235      Lexy     Derek    235       13        7
## 236      Lexy Francesca    236       13        8
## 237      Lexy    Justin    237       13        9
## 238      Lexy     Kayla    238       13       10
## 239      Lexy    Kelsey    239       13       11
## 240      Lexy   Kiffani    240       13       12
## 241      Lexy      Maya    241       13       14
## 242      Lexy   Mckenna    242       13       15
## 243      Lexy     Megan    243       13       16
## 244      Lexy  Michaela    244       13       17
## 245      Lexy   Richard    245       13       18
## 246      Lexy     Wyatt    246       13       19
## 247      Lexy   Zackary    247       13       20
## 248      Maya Alexander    248       14        1
## 249      Maya    Andrey    249       14        2
## 250      Maya   Breanna    250       14        3
## 251      Maya   Charles    251       14        4
## 252      Maya    Colton    252       14        5
## 253      Maya   Crystal    253       14        6
## 254      Maya     Derek    254       14        7
## 255      Maya Francesca    255       14        8
## 256      Maya    Justin    256       14        9
## 257      Maya     Kayla    257       14       10
## 258      Maya    Kelsey    258       14       11
## 259      Maya   Kiffani    259       14       12
## 260      Maya      Lexy    260       14       13
## 261      Maya   Mckenna    261       14       15
## 262      Maya     Megan    262       14       16
## 263      Maya  Michaela    263       14       17
## 264      Maya   Richard    264       14       18
## 265      Maya     Wyatt    265       14       19
## 266      Maya   Zackary    266       14       20
## 267   Mckenna Alexander    267       15        1
## 268   Mckenna    Andrey    268       15        2
## 269   Mckenna   Breanna    269       15        3
## 270   Mckenna   Charles    270       15        4
## 271   Mckenna    Colton    271       15        5
## 272   Mckenna   Crystal    272       15        6
## 273   Mckenna     Derek    273       15        7
## 274   Mckenna Francesca    274       15        8
## 275   Mckenna    Justin    275       15        9
## 276   Mckenna     Kayla    276       15       10
## 277   Mckenna    Kelsey    277       15       11
## 278   Mckenna   Kiffani    278       15       12
## 279   Mckenna      Lexy    279       15       13
## 280   Mckenna      Maya    280       15       14
## 281   Mckenna     Megan    281       15       16
## 282   Mckenna  Michaela    282       15       17
## 283   Mckenna   Richard    283       15       18
## 284   Mckenna     Wyatt    284       15       19
## 285   Mckenna   Zackary    285       15       20
## 286     Megan Alexander    286       16        1
## 287     Megan    Andrey    287       16        2
## 288     Megan   Breanna    288       16        3
## 289     Megan   Charles    289       16        4
## 290     Megan    Colton    290       16        5
## 291     Megan   Crystal    291       16        6
## 292     Megan     Derek    292       16        7
## 293     Megan Francesca    293       16        8
## 294     Megan    Justin    294       16        9
## 295     Megan     Kayla    295       16       10
## 296     Megan    Kelsey    296       16       11
## 297     Megan   Kiffani    297       16       12
## 298     Megan      Lexy    298       16       13
## 299     Megan      Maya    299       16       14
## 300     Megan   Mckenna    300       16       15
## 301     Megan  Michaela    301       16       17
## 302     Megan   Richard    302       16       18
## 303     Megan     Wyatt    303       16       19
## 304     Megan   Zackary    304       16       20
## 305  Michaela Alexander    305       17        1
## 306  Michaela    Andrey    306       17        2
## 307  Michaela   Breanna    307       17        3
## 308  Michaela   Charles    308       17        4
## 309  Michaela    Colton    309       17        5
## 310  Michaela   Crystal    310       17        6
## 311  Michaela     Derek    311       17        7
## 312  Michaela Francesca    312       17        8
## 313  Michaela    Justin    313       17        9
## 314  Michaela     Kayla    314       17       10
## 315  Michaela    Kelsey    315       17       11
## 316  Michaela   Kiffani    316       17       12
## 317  Michaela      Lexy    317       17       13
## 318  Michaela      Maya    318       17       14
## 319  Michaela   Mckenna    319       17       15
## 320  Michaela     Megan    320       17       16
## 321  Michaela   Richard    321       17       18
## 322  Michaela     Wyatt    322       17       19
## 323  Michaela   Zackary    323       17       20
## 324   Richard Alexander    324       18        1
## 325   Richard    Andrey    325       18        2
## 326   Richard   Breanna    326       18        3
## 327   Richard   Charles    327       18        4
## 328   Richard    Colton    328       18        5
## 329   Richard   Crystal    329       18        6
## 330   Richard     Derek    330       18        7
## 331   Richard Francesca    331       18        8
## 332   Richard    Justin    332       18        9
## 333   Richard     Kayla    333       18       10
## 334   Richard    Kelsey    334       18       11
## 335   Richard   Kiffani    335       18       12
## 336   Richard      Lexy    336       18       13
## 337   Richard      Maya    337       18       14
## 338   Richard   Mckenna    338       18       15
## 339   Richard     Megan    339       18       16
## 340   Richard  Michaela    340       18       17
## 341   Richard     Wyatt    341       18       19
## 342   Richard   Zackary    342       18       20
## 343     Wyatt Alexander    343       19        1
## 344     Wyatt    Andrey    344       19        2
## 345     Wyatt   Breanna    345       19        3
## 346     Wyatt   Charles    346       19        4
## 347     Wyatt    Colton    347       19        5
## 348     Wyatt   Crystal    348       19        6
## 349     Wyatt     Derek    349       19        7
## 350     Wyatt Francesca    350       19        8
## 351     Wyatt    Justin    351       19        9
## 352     Wyatt     Kayla    352       19       10
## 353     Wyatt    Kelsey    353       19       11
## 354     Wyatt   Kiffani    354       19       12
## 355     Wyatt      Lexy    355       19       13
## 356     Wyatt      Maya    356       19       14
## 357     Wyatt   Mckenna    357       19       15
## 358     Wyatt     Megan    358       19       16
## 359     Wyatt  Michaela    359       19       17
## 360     Wyatt   Richard    360       19       18
## 361     Wyatt   Zackary    361       19       20
## 362   Zackary Alexander    362       20        1
## 363   Zackary    Andrey    363       20        2
## 364   Zackary   Breanna    364       20        3
## 365   Zackary   Charles    365       20        4
## 366   Zackary    Colton    366       20        5
## 367   Zackary   Crystal    367       20        6
## 368   Zackary     Derek    368       20        7
## 369   Zackary Francesca    369       20        8
## 370   Zackary    Justin    370       20        9
## 371   Zackary     Kayla    371       20       10
## 372   Zackary    Kelsey    372       20       11
## 373   Zackary   Kiffani    373       20       12
## 374   Zackary      Lexy    374       20       13
## 375   Zackary      Maya    375       20       14
## 376   Zackary   Mckenna    376       20       15
## 377   Zackary     Megan    377       20       16
## 378   Zackary  Michaela    378       20       17
## 379   Zackary   Richard    379       20       18
## 380   Zackary     Wyatt    380       20       19

Note that any observed event involving actor pairs outside manual.riskset will be automatically added to the risk set, ensuring that the likelihood is well-defined for all observed events.

The grid visualization below illustrates the manual risk set at time \(t_3\), with dyads involving "Richard" and "Francesca" excluded (white tiles).

Visualizing manual risk set at time t3

Here, tiles for dyads involving "Richard" and "Francesca" are white (excluded); the risk set contains only dyads among "Colton", "Kayla", and "Lexy".

For undirected networks, the same manual.riskset logic applies but the grid visualization focuses on the lower triangular, since actor pairs are sorted alphanumerically.

Visualizing manual risk set at time t3 - undirected

The processed risk set

After processing, the remify object exposes the risk set through riskset_info (when attach_riskset = TRUE, which is the default). The key field is riskset_info$included, which contains the decoded table of at-risk dyads:

reh_active <- remify(
  edgelist       = randomREH$edgelist,
  directed       = TRUE,
  ordinal        = FALSE,
  model          = "tie",
  actors         = randomREH$actors,
  riskset        = "active",
  origin         = randomREH$origin,
  riskset_decode = "labels"
)

head(reh_active$riskset_info$included)
##      actor1  actor2 dyadID actor1ID actor2ID
## 1 Alexander  Andrey      1        1        2
## 2 Alexander Breanna      2        1        3
## 3 Alexander Charles      3        1        4
## 4 Alexander  Colton      4        1        5
## 5 Alexander Crystal      5        1        6
## 6 Alexander   Derek      6        1        7
nrow(reh_active$riskset_info$included) # number of active dyads
## [1] 380

For the full risk set, the dyad map is accessible directly via reh$index$dyad_map. For active or manual risk sets, it is in reh$index$dyad_map_active.

The per-event dyad IDs (mapping each observed event to its position in the risk set) are stored in reh$ids$dyad:

# dyadID of the first 10 observed events
head(reh_active$ids$dyad, 10)
##  [1] 182  84 203   4 353 117 334 254 102  56

For actor-oriented modeling with an active or manual risk set, sender and receiver risk sets are stored in reh$sender_riskset and reh$receiver_riskset respectively, and reh$index$sender_map provides the mapping between sender IDs and actor names.