This function checks the validity of a dyadic interaction matrix by ensuring that each interaction start event has a corresponding end event, that no interactions overlap within a dyad, and that no missing values are present.
Arguments
- df
A data frame with at least four columns, representing events, where:
- Column 1
Event timing or ID (e.g., timestamp).
- Column 2
"From" node ID for the dyadic interaction.
- Column 3
"To" node ID for the dyadic interaction.
- Column 4
Event type (1 for start, 0 for end of interaction).
- return_matrix
Logical; if TRUE, returns the (potentially repaired) event matrix. Defaults to FALSE, in which case the function returns
TRUEif the matrix is valid.- start_time
Numeric; optional reference time for adding missing start events. Defaults to NULL, in which case the earliest time in the data is used.
Value
Logical; TRUE if all interactions are valid, FALSE otherwise.
If the data contains missing values, the function issues a warning and returns FALSE.
Details
The function performs the following checks:
Missing values: If any are found, a warning is issued and
FALSEis returned.Interaction pairing: Each start event (1) must have a corresponding end event (0) without overlap.
Non-overlapping intervals: Ensures that no start event occurs while another interaction is active.
