Introduction

Temporal networks, where links connecting pairs of nodes are not continuously active, provide a framework to model how the interactions of a complex system evolve in time1,2,3. They have revealed key in understanding how the time-varying interaction network of real-world social and biological systems affects the properties of dynamical processes, such as epidemic spreading4,5,6,7, diffusion8,9,10,11,12, synchronization13,14, and others15,16,17,18. Recent results have highlighted the complex way in which the activity of each link depends on the activities of all other links, showing that memory19,20,21,22 in temporal networks is inherently a multidimensional concept with a well defined microscopic shape23. Different approaches have aimed to describe the time evolution of a network as a trajectory in graph space, by naturally extending to the case of graphs notions such as correlations24 or even dynamical stability25 traditionally used for scalar or vectorial time-series.

Temporal network approaches, however, have a strong limitation. They are based on a graph description and, as such, they can only describe how dyadic interactions (i.e., links) vary in time, neglecting many-body interactions. Indeed, many real-world social26,27,28,29,30, biological31,32, neural33,34 or ecological35,36 systems also exhibit higher-order interactions, i.e., interactions involving groups of three or more units at the same time. Such many-body interactions are better modeled by higher-order networks, such as hypergraphs and simplicial complexes, where hyperedges and simplices encode interactions among an arbitrary number of units37,38. Interestingly, taking into account the higher-order architecture of real-world systems is known to produce novel collective phenomena in a variety of dynamical processes, including diffusion39,40, synchronization41,42,43,44,45, contagion46,47 and evolutionary games48,49.

Some early works have already started to explore the temporal dimension of higher-order interactions. For instance, group interactions in real-world social systems have been found to occur in persistent bursts of activity28, with events of different sizes close in time also spatially correlated in the network50. Such persistent temporal higher-order interactions have been shown to anticipate the onset of endemic states in epidemic processes51, and to affect the convergence time of nonlinear consensus dynamics52. Theoretical frameworks for modeling temporal group activation data53,54, and for constructing simplicial complexes based on topological data analysis of multivariate time-series from brain functional activity, financial markets and disease spreading55 have also been recently developed. However, how to analyze and characterize the temporal organization of real-world complex systems with higher-order interactions is, to this day, an open problem.

In this article, we bridge this gap by introducing a general framework to study higher-order temporal dependencies in complex systems. We represent a complex system with interactions in groups whose size and composition can change in time as a temporal hypergraph, i.e., a hypergraph with time-varying hyperedges of different orders. We then define a set of measures to extract higher-order temporal correlations, namely to characterize how the dynamics of hyperedges of different orders are correlated. We test our framework on a variety of empirical social systems, where patterns are amenable to intuitive interpretations and validation. Results show the existence of long-range correlations at different group sizes and their hierarchical organization. Furthermore, we uncover the presence of temporal correlations between groups of different sizes, i.e., between hyperedges of different orders, unveiling the existence of persistent dynamical relationships between coherent mesoscopic structures previously unaccounted for. Finally, to gain intuition about the underlying microscopic mechanisms, we introduce novel theoretical models of temporal hypergraphs with higher-order memory, able to explain the observed empirical patterns. Beyond networked systems, our measures and models open the door to investigate interactions among emergent coherent structures and other multi-scale phenomena in complex systems.

Results

Temporal correlations in hypergraphs

To represent the temporal evolution of systems with higher-order interactions we rely on temporal hypergraphs28,56. A temporal hypergraph is a tuple \(({{{{{{{\mathcal{V}}}}}}}},{\{{{{{{{{\mathcal{H}}}}}}}}(t)\}}_{t=1}^{T})\), where \({{{{{{{\mathcal{V}}}}}}}}\) is a set of N nodes, and \({\{{{{{{{{\mathcal{H}}}}}}}}(t)\}}_{t=1}^{T}\) is a sequence of T sets. Each \({{{{{{{\mathcal{H}}}}}}}}(t)\) is a set of M(t) hyperedges, representing the interactions among the system units at time t. Each hyperedge represents an interaction among multiple units. A hyperedge of order 2, or 2-hyperedge, is a set of two nodes representing a two-body interaction, a 3-hyperedge is a set of three nodes representing a group interaction among three units, and so on, up to order D. To study the temporal organization of systems with higher-order interactions, we represent the temporal hypergraphs as a set of D − 1 sequences \({\{{{{{{{{{\bf{A}}}}}}}}}^{(d)}(t)\}}_{t=1}^{T}=\{{{{{{{{{\bf{A}}}}}}}}}^{(d)}(1) ,{{{{{{{{\bf{A}}}}}}}}}^{(d)}(2),\ldots ,{{{{{{{{\bf{A}}}}}}}}}^{(d)}(T)\}\) where the element \({a}_{ij}^{(d)}(t)\) of matrix A(d)(t) counts the number of d-hyperedges nodes i and j belong to at time t, while \({a}_{ii}^{(d)}(t)=0\,\forall i\). See Methods for more details on how to represent temporal hypergraphs.

The presence of higher-order interactions makes the analysis of temporal correlations a multi-faceted problem. First, to quantify temporal correlations in interactions of a given order d, we introduce the intra-order correlation matrix

$${{{{{{{{\mathcal{C}}}}}}}}}^{(d)}(\tau )=\frac{1}{T-\tau }\sum\limits_{t=1}^{T-\tau }\frac{1}{(d-1){!}^{2}}\left[{{{{{{{{\bf{A}}}}}}}}}^{(d)}(t)-{\mu }^{(d)}\right]\cdot {\left[{{{{{{{{\bf{A}}}}}}}}}^{(d)}(t+\tau )-{\mu }^{(d)}\right]}^{\top },$$
(1)

with d ∈ {2, …, D}. Here, τ is the temporal lag, A denotes the transpose of A, and we have defined the annealed adjacency matrix of order d as \({\mu }^{(d)}=\frac{1}{T}{\sum }_{t=1}^{T}{{{{{{{{\bf{A}}}}}}}}}^{(d)}(t)\). Note that, for d = 2, Eq. (1) recovers the correlation matrix for temporal networks24. The diagonal terms of \({{{{{{{{\mathcal{C}}}}}}}}}^{(d)}(\tau )\) capture how hyperedges of order d are temporally autocorrelated, whereas the off-diagonal terms quantify cross-correlations. When the latter are negligible, one can focus on the diagonal terms and define an intra-order correlation function

$${c}^{(d)}(\tau )={{{{{{{\rm{tr}}}}}}}}({{{{{{{{\mathcal{C}}}}}}}}}^{(d)}(\tau )),$$
(2)

that provides a scalar measure of how hyperedges of order d are autocorrelated at lag τ.

Second, we can inquire whether interactions of two different orders d1 and d2 display temporal interdependence, i.e., whether mesoscopic structures are dynamically interrelated or, conversely, evolve independently. To this aim, we introduce the cross-order correlation matrix

$${{{{{{{{\mathcal{C}}}}}}}}}^{({d}_{1},{d}_{2})}(\tau )=\sum\limits_{t=1}^{T-\tau }\frac{\left[{{{{{{{{\bf{A}}}}}}}}}^{({d}_{1})}(t)-{\mu }^{({d}_{1})}\right]\cdot {\left[{{{{{{{{\bf{A}}}}}}}}}^{({d}_{2})}(t+\tau )-{\mu }^{({d}_{2})}\right]}^{\top }}{(T-\tau )({d}_{1}-1)!({d}_{2}-1)!},$$
(3)

where d1, d2 ∈ {2, …, D}. Note that, when d1 = d2 = d, we recover the intra-order correlation matrix \({{{{{{{{\mathcal{C}}}}}}}}}^{(d)}\). We then define a scalar cross-order correlation function as

$${c}^{({d}_{1},{d}_{2})}(\tau )={{{{{{{\rm{tr}}}}}}}}({{{{{{{{\mathcal{C}}}}}}}}}^{({d}_{1},{d}_{2})}(\tau )).$$
(4)

All the information about intra-order and cross-order correlations can be encoded in a (D − 1) × (D − 1) normalized interaction matrix \({{{{{{{{\mathcal{K}}}}}}}}}_{{d}_{1}{d}_{2}}(\tau )={c}^{({d}_{1},{d}_{2})}(\tau )/2\sqrt{{\sigma }^{({d}_{1})}{\sigma }^{({d}_{2})}}\), where σ(d) = c(d)(0), whose entry \({{{{{{{{\mathcal{K}}}}}}}}}_{{d}_{1}{d}_{2}}(\tau )\) describes how interactions of order d1 at a given time are correlated with those of order d2 occurring τ time steps later. Notice that matrix \({{{{{{{{\mathcal{K}}}}}}}}}_{{d}_{1}{d}_{2}}(\tau )\) is not symmetric, as the quantity \({c}^{({d}_{2},{d}_{1})}(\tau )\) measures how order d1 is correlated with order d2 at τ time steps before, and is in general different from \({c}^{({d}_{1},{d}_{2})}(\tau )\). The presence of a significant discrepancy between these two quantities captures asymmetries in the temporal dependencies between different orders of interaction. We quantify such an asymmetry in terms of a cross-order gap function

$${\delta }^{({d}_{1},{d}_{2})}(\tau )=\frac{{c}^{({d}_{1},{d}_{2})}(\tau )-{c}^{({d}_{2},{d}_{1})}(\tau )}{2\sqrt{{\sigma }^{({d}_{1})}{\sigma }^{({d}_{2})}}}.$$
(5)

A positive value of \({\delta }^{({d}_{1},{d}_{2})}(\tau )\) indicates that the presence of groups of size d1 correlates with the presence of groups of size d2 after a time lag τ, more than the other way around.

Analysis of human interaction data

To explore intra-order and cross-order correlations in complex systems, we consider different social systems, for which we have high-resolution empirical data about their temporal evolution. We first focus on a dataset describing face-to-face interactions over a period of 32h among the N = 403 participants of a scientific conference57,58 (three further cases, namely the social interactions occurring in an office59, in a hospital ward60 and in a university campus61 are described in the Supplementary information). We encode the fine-grained temporal information of the dataset in a temporal hypergraph \(({{{{{{{\mathcal{V}}}}}}}},{\{{{{{{{{\mathcal{H}}}}}}}}(t)\}}_{t=1}^{T})\), with \(| {{{{{{{\mathcal{V}}}}}}}}|=403\). Each set \({{{{{{{\mathcal{H}}}}}}}}(t)\) is constructed by assuming that d individuals in contact at a given time t interact together in a group of size d, thus corresponding to a hyperedge of order d at time t. See Methods for details on how to reconstruct higher-order interactions from empirical data.

We begin by studying how and if groups of a given size are temporally correlated, i.e., if mesoscopic persistent structures emerge. Figure 1 reports the intra-order correlation functions c(d)(τ) for orders d ∈ {2, …, 5} (circles). Significant long-range temporal autocorrelations are found for different orders of interaction, as indicated by the slow decays of c(d)(τ) with τ in a double logarithmic scale, up to a threshold, which typically decreases with d. This indicates that groups, i.e., coherent structures, of larger sizes generally remain autocorrelated for shorter times. Interestingly, we also observe a saturation effect for interactions in groups of size three, with a series of peaks revealing a weak periodicity at large timescales (see Supplementary information for further details). Empirical results are also compared with a null model (squares) obtained by reshuffling the sequence defining the temporal hypergraph.

Fig. 1: Intra-order correlations in human face-to-face interactions.
figure 1

Circles show the value of the intra-order correlation functions c(d)(τ) for interactions in groups of size d ∈{2, …, 5}. Squares refer to a randomized null model where temporal correlations have been removed by reshuffling time steps.

We then investigate whether interactions in groups of a given size d1 can also be correlated to interactions in groups of size d2 ≠ d1, i.e., whether mesoscopic structures are related to each other. The cross-order correlation functions c(4, 5)(τ) (cyan circles) and c(5, 4)(τ) (olive circles) for groups of sizes four and five, are reported in Fig. 2a (see Supplementary information for an analysis of other group sizes). For clarity of presentation, we display a binned average of the cross-correlations functions, as well as the corresponding standard deviation. Remarkably, both cross-order correlation functions show precise patterns that can not be reproduced by the corresponding null model (squares), indicating non-trivial relationships between mesoscopic coherent structures. Namely, groups of sizes four and five in this social system show a non-trivial and persistent dependence.

Fig. 2: Cross-order correlations in human face-to-face interactions.
figure 2

a Cross-order correlation functions, c(4, 5)(τ) (cyan) and c(5, 4)(τ) (olive), describing the temporal dependencies between interactions of order four and interactions of order five. We compare the empirical system (circles) with a randomized null model with reshuffled time-steps (squares). b Normalized interaction matrix \({{{{{{{{\mathcal{K}}}}}}}}}_{{d}_{1}{d}_{2}}(\tau )\), encoding the temporal dependencies between any pairs of order d1, d2 ∈ {2, …, 5} at time lag τ = 600s. c Cross-order gap function δ(4, 5)(τ) (purple circles), compared with the null model (green squares). The values of the cross-order correlation and the cross-order gap functions are binned averaged, with the error bars representing the standard deviation.

Figure 2b shows the normalized interaction matrix \({{{{{{{\mathcal{K}}}}}}}}(\tau )\) at time lag τ = 600s (see Supplementary information for an analysis of different τ). We observe a banded structure around the main diagonal, meaning that cross-order correlations are higher between groups of similar sizes. This indicates that, in the interactions at a scientific conference analyzed here, groups change gradually, with the loss or the addition of one or few members (see Supplementary information for the interaction matrix of different social systems, including the social contacts in a university campus where large groups reveal a more complex correlation pattern). Finally, Fig. 2c shows the cross-order gap function δ(4, 5)(τ) (purple circles). Positive values of δ(4, 5)(τ)  in almost the entire range of the time lag τ considered indicate that groups of size four at a given time are correlated to those of size five occurring τ time steps later, more than the other way around. This result, which again cannot be reproduced by the null model (green squares), suggests that the formation of a group of five individuals from a group of four is more likely than the loss of one member in groups of five individuals, indicating a preferred temporal direction in the dynamics of group nucleation/fragmentation of this social system (see Supplementary information for an analysis of \({\delta }^{({d}_{1},{d}_{2})}(\tau )\) for other group sizes).

The temporal patterns revealed in real-world systems by our framework can be related to other properties of such systems. For instance, the existence of cross-order temporal correlations might explain the presence of overlapping structures, namely the tendency of different hyperedges to share nodes or to be included one within another, observed in temporally-aggregated hypergraphs26,29,62,63.

Models of hypergraphs with higher-order memory

To investigate the mechanisms shaping intra-order and cross-order correlation profiles, we introduce two models to generate synthetic temporal hypergraphs with higher-order memory, inspired by DAR processes21,23,64. The first model, named Discrete Auto Regressive Hypergraph (DARH) model, treats the binary states of each hyperedge hα ∈ {0, 1} (absent/present) as independent stochastic processes. Each hyperedge updates its state either drawing a state from its past, or randomly sampling a new state. With probability q(d), where d ∈ {2, …, D}, a hyperedge of order d samples its state uniformly at random from its \({m}_{s}^{(d)}\) previous states, while with probability 1 − q(d), the hyperedge state is drawn randomly following a Bernoulli process with probability y(d). In this way, the tuning parameter q(d) controls the memory strength21 of the hyperedges of order d. See Methods for a detailed description of the DARH model. Our first model displays intra-order correlations (i.e., the existence of mesoscopic persistent structures), but no cross-order correlations (i.e., these coherent structures do not interact). See Supplementary information for a characterization of the DARH model.

We then introduce a second model, the cross-memory DARH (cDARH) model, a variation of the DARH model where a hyperedge of order d can update its state by drawing not only from its \({m}_{s}^{(d)}\) previous states but also from the \({m}_{c}^{({d}^{{\prime} },d)}\) previous states of a hyperedge of a different order \({d}^{{\prime} }\). This updating mechanism, to which we will refer as cross-order memory, is what ultimately allows the model to account for interactions among coherent structures. The parameter \({m}_{s}^{(d)}\) represents the intra-order memory length of the hyperedges of order d, while \({m}_{c}^{({d}^{{\prime} },d)}\) is the cross-order memory length. When copying from memory, each hyperedge draws from the past of other hyperedges with probability p(d), and from its own past with probability 1 − p(d). We assume that hyperedges can copy from the memory of overlapping hyperedges only. This choice is motivated by previous studies on higher-order interactions in social networks pointing out a tendency of groups to progressively add or remove members, one step at a time28. For illustration, let us consider the case of groups of size two and three: a 2-hyperedge {i, j} selects one of the (N − 2) possible 3-hyperedges containing nodes i and j and draws from its previous \({m}_{c}^{(3,2)}\) states. Similarly, a 3-hyperedge {i, j, k} selects one of the three 2-hyperedges that can be formed from it, i.e., {i, j}, {j, k}, and {i, k}, and copies a state from its previous \({m}_{c}^{(2,3)}\) steps (see Fig. 3a–b for a schematic illustration of the model). Such a mechanism can be straightforwardly extended to hyperedges of other orders. See Methods for more details about the cDARH model.

Fig. 3: Temporal correlations in the cross-memory Discrete Auto Regressive Hypergraph (cDARH) model.
figure 3

a An illustration of the cDARH model. At each time t, the state of a hyperedge of order d is updated either randomly, with a probability 1 − q(d), or through a memory-based process, with a probability q(d) (d = 2 in the illustration). In the latter case, the state is updated by copying either a previous state from the past of the hyperedge (intra-order memory) or a previous state of an overlapping hyperedge of a different order (cross-order memory), according to a probability p(d). b A schematic illustration of the memory-based state update of a 2-hyperedge in the cDARH model. With probability 1 − p(2), the state is drawn from one of the \({m}_{s}^{(2)}\) previous states of the hyperedge, while with probability p(2) it is sampled from one of the \({m}_{c}^{(3,2)}\) previous states of a overlapping hyperedge of order 3. c Intra-order correlations c(d), with d ∈ {2, 3}, for hyperedges of order two (green circles and squares) and three (orange circles and squares). d Cross-order gap function δ(2, 3) between hyperedges of order two and three. We compare intra-order and cross-order correlations for the hypergraph generated using the cDARH model with a randomized null model. The values of the cross-order gap functions are binned averaged, with the error bars representing the standard deviation.

We generate with the cDARH model temporal hypergraphs with N = 10 nodes, maximum hyperedge order D = 3 and a temporal range of T = 3 ⋅ 104 time steps. Note that real-world systems are usually characterized by a larger number of units. However, generating a temporal hypergraph with a realistic size using the cDARH model can be computationally costly. Yet our model is able to describe the patterns observed in the data even considering a few nodes. See Supplementary information for an analysis of larger hypergraphs. We set p(2) = 0 and p(3) = 0.6, meaning that hyperedges of order three can copy from the past of hyperedges of order two, while hyperedges of order two evolve independently. We also set \({m}_{c}^{(2,3)}=60\), for the cross-order memory length of 3-hyperedges. Considering a single couple of intra-order memory lengths \({m}_{s}^{(2)},{m}_{s}^{(3)}\) for all hyperedges of order two and three, respectively, the cDARH model displays both intra-order and cross-order correlations. Yet the profiles of c(d)(τ) do not match exactly those of empirical data. In particular, the functions c(2) and c(3) remain constant for \(\tau \le {m}_{s}^{(d)}\) and decay exponentially after that value, with the same rate of decay (see Supplementary information for a deeper analysis), while in empirical systems the correlation functions follow a power-law decay. This is not surprising, as real-world social interactions can be shaped by different scales of memory23. Hence, we sample the intra-order memory length of a hyperedge of order d from a uniform distribution, with maximum values for the interactions of orders two and three set to \({m}_{s,\max }^{(2)}=40\), and \({m}_{s,\max }^{(3)}=10\), respectively. In Fig. 3c we observe that the profile of the intra-order correlation functions c(d) shows a slow decay followed by a loss of correlation, which is in good agreement with what we see in the empirical networks. Such a minimal model reveals that memory can be the driving mechanism for the emergence of intra-order temporal correlations, with different orders possessing different degrees of memory, also explaining the hierarchical structure of correlation observed in the data. Figure 3d shows that δ(2, 3)(τ) > 0 for different values of τ (purple circles), meaning that hyperedges of order two are correlated to hyperedges of order three occurring later in time more than the other way around. We observe a striking similarity between this trend and that observed in Fig. 2c for the empirical data. This result indicates that cross-order memory is a fundamental factor for the emergence of cross-order correlations among different orders of interaction as well as cross-order gaps in real-world social systems. The two peaks for δ(4, 5)(τ) observed in the empirical system suggest again a more complex dependence on memory, possibly due to multiple temporal scales.

Discussion

In this article, we have introduced a framework to characterize different dimensions of memory in networked systems with higher-order interactions. We have shown that real-world social systems display long-range temporal correlations at different group sizes –i.e., that coherent mesoscopic structures emerge–, organized in a hierarchy across multiple scales. Moreover, we have found that group interactions are characterized by non-trivial cross-order correlations, with cross-memory being a fundamental mechanism underlying such a complex behavior. In the context of social systems, such cross-order interactions can be interpreted in terms of the schisming phenomenon65,66,67,68, where groups in human interactions, e.g. conversations, fluctuate, nucleate, and display complex dynamics.

In conclusion, our work sheds light on the multifaceted nature of memory that emerges at different scales in real-world interacting systems. The analyses presented here can be naturally extended to other higher-order complex systems traditionally modeled in terms of networks of interactions, such as the human brain and biological ecosystems. Beyond the scope of network science, we hope that our framework can open new avenues to reveal the higher-order dynamics of coherent structures in a variety of physical systems, from multifragmentation in nuclear physics to vortex-vortex interaction in the atmosphere or other fluid dynamical systems.

Methods

Representation of time-varying systems with higher-order interactions

Systems with higher-order interactions can be represented as hypergraphs56. A hypergraph is a tuple \(({{{{{{{\mathcal{V}}}}}}}},{{{{{{{\mathcal{H}}}}}}}})\), where \({{{{{{{\mathcal{V}}}}}}}}\) is a set of N nodes, and \({{{{{{{\mathcal{H}}}}}}}}\) is a set of M hyperedges. Each hyperedge represents an interaction among two or more units. A hyperedge of order 2, or 2-hyperedge, is a set of two nodes representing a two-body interaction, a 3-hyperedge is a set of three nodes representing an interaction among three units, and so on, up to order D. While hypergraphs are usually represented by adjacency tensors of different ranks, to capture dynamical dependencies within and among orders we will rely instead on a set of adjacency matrices of the same rank. First, we consider a set of incidence matrices [E(2), E(3), …, E(D)] where the element \({e}_{i\alpha }^{(d)}\) of matrix E(d) is one if node i belongs to the d-hyperedge α, while it is zero otherwise. For each order of interaction d, we can then construct an adjacency matrix A(d) as

$${{{{{{{{\bf{A}}}}}}}}}^{(d)}={{{{{{{{\bf{E}}}}}}}}}^{(d)}{{{{{{{{\bf{E}}}}}}}}}^{(d)\top }-{{{{{{{\rm{diag}}}}}}}}({{{{{{{{\bf{E}}}}}}}}}^{(d)}{{{{{{{{\bf{E}}}}}}}}}^{(d)\top }).$$
(6)

The off-diagonal elements \({a}_{ij}^{(d)}={\sum }_{\alpha }{e}_{i\alpha }{e}_{j\alpha }\) represents the number of d-hyperedges nodes i and j belong to, while \({a}_{ii}^{(d)}=0\,\forall i\).

To represent a system with higher-order interactions evolving in time we rely on temporal hypergraphs28. A temporal hypergraph is a tuple \(({{{{{{{\mathcal{V}}}}}}}},{\{{{{{{{{\mathcal{H}}}}}}}}(t)\}}_{t=1}^{T})\), where \({{{{{{{\mathcal{V}}}}}}}}\) is again a set of N nodes, and \({\{{{{{{{{\mathcal{H}}}}}}}}(t)\}}_{t=1}^{T}\) is a sequence of T sets. Each \({{{{{{{\mathcal{H}}}}}}}}(t)\) is a set of M(t) hyperedges, representing the interactions occurring at time t. For each order of interaction d, we can define a sequence \({\{{{{{{{{{\bf{A}}}}}}}}}^{(d)}(t)\}}_{t=1}^{T}=\{{{{{{{{{\bf{A}}}}}}}}}^{(d)}(1),{{{{{{{{\bf{A}}}}}}}}}^{(d)}(2),\ldots,{{{{{{{{\bf{A}}}}}}}}}^{(d)}(T)\}\), where A(d)(t) is an adjacency matrix encoding the interactions of order d occurring at time t. Hence, we can fully represent the temporal evolution of the system using a set of D − 1 sequences \([{\{{{{{{{{{\bf{A}}}}}}}}}^{(2)}(t)\}}_{t=1}^{T},{\{{{{{{{{{\bf{A}}}}}}}}}^{(3)}(t)\}}_{t=1}^{T},\ldots,{\{{{{{{{{{\bf{A}}}}}}}}}^{(D)}(t)\}}_{t=1}^{T}]\).

Reconstruction of higher-order social interactions from empirical data

To investigate the temporal organization of social interactions, we rely on four datasets, three coming from the SocioPatterns project57,58,59,60 and one from the Copenhagen Network Study61. These datasets store the interactions among the individuals as a temporal network, namely they contain dyadic interactions only. However, as people often engage in groups where more than two individuals interact at the same time, a network description of the system might result in an inadequate representation of the system. Still, the fine-grained temporal information of the datasets allows us to extract group interactions from the data. In particular, we assume that d individuals that are in contact through dyadic interactions at a given time t interact together in a group of size d. For instance, if at time t individual i is in contact with individuals j and k, while individual j is also interacting with individual k, we assume individuals i, j and k to be engaged in a group interaction. Mathematically, if at time t a set of d nodes form a clique in the temporal network, we promote the clique to a d-hyperedge in the temporal hypergraph.

The DARH and the cDARH models

To investigate the mechanisms shaping the onset of intra-order and cross-order correlations in temporal hypergraphs, we introduce two theoretical models that generate temporal hypergraphs with higher-order memory. The first model, called the Discrete Auto Regressive Hypergraph (DARH) model, treats the binary states of each hyperedge hα ∈ {0, 1} (absent/present) as independent stochastic processes. The state of each hyperedge is updated either randomly or by drawing one of the previous states of the hyperedge. In particular, with a probability 1 − q(d), the hyperedge state is drawn randomly according to a Bernoulli process, i.e., the hyperedge is present with a probability y(d), or it is absent with a probability 1 − y(d) . Note that d ∈ {2, …, D} represents the order of the hyperedge, meaning that for each order of interaction separately we can tune the sampling probabilities q(d) and y(d). With probability q(d), instead, the next state is sampled uniformly at random from the \({m}_{s}^{(d)}\) previous states of the hyperedge. Formally, the dynamics of the state of a hyperedge α of order d, hα, is given by

$${h}_{t}^{\alpha }={Q}_{t}{h}_{t-{\mu }_{t}}^{\alpha }+(1-{Q}_{t}){Y}_{t}$$
(7)

where Qt ~ Bernoulli(q(d)) is a random variable selecting how the state of the hyperedge is updated, Yt ~ Bernoulli(y(d)) defines whether the hyperedge is present/absent when its state is selected randomly, while \({\mu }_{t} \sim {{{{{{{\rm{Uniform}}}}}}}}(1,{m}_{s}^{(d)})\) determines which state is drawn when the update is done by sampling from the hyperedge past.

The second model, named the cross-memory DARH (cDARH) model, is a variation of the DARH model where a hyperedge of order d can update its state by drawing not only from its past but also from that of a hyperedge of a different order. Similar to the DARH model, with a probability 1 − q(d), the hyperedge state is drawn randomly according to a Bernoulli process with probability y(d), while the state is copied from past states with a probability q(d). When copying from memory, with probability 1 − p(d) the state of the hyperedge is sampled uniformly at random from its \({m}_{s}^{(d)}\) previous states. With probability p(d), instead, the state of the hyperedge is drawn from the \({m}_{c}^{({d}^{{\prime} },d)}\) previous states of an overlapping hyperedge of order \({d}^{{\prime} }\) that overlaps. The order \({d}^{{\prime} }\) of the hyperedge can be drawn according to a given probability distribution \({\rho }^{(d)}({d}^{{\prime} })\). Formally, we can write the dynamics of the state of a hyperedge α of order d, hα, as

$${h}_{t}^{\alpha }={Q}_{t}{h}_{t-{\mu }_{t}}^{{\varepsilon }_{t}(\alpha )}+(1-{Q}_{t}){Y}_{t}.$$
(8)

As for the DARH model, Qt ~ Bernoulli(q(d)) is a random variable selecting how to update the state of the hyperedge, while Yt ~ Bernoulli(y(d)) determines if the hyperedge is present/absent when sampling randomly. εt(α) is a random variable that defines if the update of the hyperedge is done by sampling from its own past or from that of another hyperedge. Mathematically, it follows the equation

$${\varepsilon }_{t}(\alpha )={P}_{t}\beta+(1-{P}_{t})\alpha,$$
(9)

where Pt ~ Bernoulli(p(d)) selects whether to copy from the past of hyperedge α or from that of another hyperedge, indexed as β. β is sampled from the set of hyperedges of order \({d}^{{\prime} }\) overlapping with α, with \({d}^{{\prime} }\) drawn from \({\rho }^{(d)}({d}^{{\prime} })\). Finally, the variable μ, determining which state from the past is sampled when copying from memory, is sampled according to the value of εt(α). In particular, when εt(α) = α, i.e., for the intra-order memory process, we have \({\mu }_{t} \sim {{{{{{{\rm{Uniform}}}}}}}}(1,{m}_{s}^{(d)})\), while we have \({\mu }_{t} \sim {{{{{{{\rm{Uniform}}}}}}}}(1,{m}_{c}^{({d}^{{\prime} },d)})\) when εt(α) ≠ α, i.e., for the cross-order memory process.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.