Temporal associations between salivary cortisol and emotions in clinically depressed individuals and matched controls: A dynamic time warp analysis

Depression can be understood as a complex dynamic system where depressive symptoms interact with one another. Cortisol is suggested to play a major role in the pathophysiology of depression, but knowledge on the temporal interplay between cortisol and depressive symptoms is scarce. We aimed to analyze the temporal connectivity between salivary cortisol and momentary affective states in depressed individuals and controls. Thirty pair-matched depressed and non-depressed participants completed questionnaires on momentary positive (PA) and negative (NA) affect and collected saliva three times a day for 30 days. The association between cortisol and affect was analyzed by dynamic time warp (DTW) analyses. These analyses involved lag-1 backward to lag-1 forward undirected analyses and lag-0 and lag-1 forward directed analyses. Large inter-and intra-individual variability in the networks were found. At the group level, with undirected analysis PA and NA were connected in the networks in depressed individuals and in controls. Directed analyses indicated that increases in cortisol preceded specific NA items in controls, but tended to follow upon specific affect items increase in depressed individuals. To conclude, at group level, changes in cortisol levels in individuals diagnosed with a depression may be a result of changes in affect, rather than a cause.


Introduction
The adrenal stress hormone cortisol has often been linked to depression (de Kloet et al., 2005).A properly controlled stress response includes a rapid activation of the hypothalamus-pituitary-adrenal (HPA)-axis and efficient termination after successful adaptation (Herman et al., 2016;Sapolsky et al., 2000).The stress-induced cortisol elevations are superimposed on the basal secretion that shows a circadian rhythm, based on brief episodic pulses of secretion (Lightman et al., 2020).Dysregulation of cortisol dynamics is thought to be implicated in the pathophysiology of stress-related disorders, for example in depressed individuals in whom hypercortisolism and impaired glucocorticoid receptor (GR) mediated feedback inhibition have been reported (de Kloet et al., 2005;Malhi and Mann, 2018).However, there is a substantial heterogeneity between studies, in which there seems to be a tendency for an increased HPA-axis activation in depression, but some studies also have shown a decreased HPA-axis activation in individuals diagnosed with depression compared to controls (Booij et al., 2015;Stetler and Miller, 2011;Vreeburg et al., 2009).Furthermore, a flatter diurnal cortisol rhythm has been associated with depression (Doane et al., 2013;Jarcho et al., 2013).Although there have been some inconsistencies in previous research, a meta-analysis revealed that flattened diurnal cortisol slopes were associated with a wide range of negative health outcomes, including depression (Adam et al., 2017).The overall inconclusive results on cortisol and mood might be explained by the temporal dynamics of cortisol levels, as affect items such as distress may affect cortisol secretionand vice versamay be affected by hypercortisolism in persons diagnosed with depression (Booij et al., 2020;Peeters et al., 2004).
In terms of interpretation, it is largely unknown whether cortisol should be viewed as a marker for stress, following the aggravation of depression symptoms, or rather as a potent neuromodulatory hormone that may affect the onset or severity of particular symptoms (Koning et al., 2019), or that it is affected by a mutual cause.This relates to the classical debate about whether inner mental states precede bodily changes or vice versa.The traditional perspective has predominantly viewed psychiatric symptoms as direct manifestations of an underlying latent disorder.There is still no consensus on neither the mechanisms or the direction of effects (Riese and Wichers, 2021).However, alternative frameworks, such as network theory and complex dynamic systems theory state that disorders may arise from intricate interplay among elements, including bodily changes and inner mental states.These may interact through complex feedback loops and vicious cycles, operating at different levels (Borsboom, 2017;Hekler et al., 2019).Rather than assuming a unidirectional causality, these frameworks highlight the bidirectional and interactive nature of psychopathological processes.
Next to fluctuations in cortisol, individual's depressive symptoms change over time as well.A depressive disorder can be viewed as a complex dynamic system, where depressive symptoms can interact and affect each other (Borsboom and Cramer, 2013;Cramer et al., 2016;Fried and Cramer, 2017;Kendler et al., 2011).The latter is in accordance with the network theory of psychopathology, in which mental disorders are assumed to develop when symptoms trigger each other over and over again in conjunction with external stressors (Borsboom, 2017).Wichers et al. (2021) proposed the momentary affect dynamics (MAD) network theory, which differs from Borsboom's network theory by postulating that momentary affective states are the building blocks for the development of the actual depressive symptoms (Wichers et al., 2021).High connectivity between negative affect states in a network is hypothesized to increase the risk towards psychopathology (Wichers et al., 2021;Wichers et al., 2015).Indeed, depression is known to be associated with higher levels of negative affect and lower levels of positive affect (Watson et al., 1988).Interestingly, dynamic network studies have highlighted the centrality of positive affect in symptom networks, indicating that changes in positive affect preceded changes into other affective states, thus likely influencing the network and consequently the overall mood state (Wichers et al., 2021).To comprehend such dynamic processes, it becomes crucial to analyse datasets that assess frequent and comprehensive assessments of momentary affective states.
With ecological momentary assessment (EMA) methods, in which participants report their current states of affect, behaviour, and daily context several times a day for multiple consecutive days, the dynamics of symptoms and affect states can be captured on a frequent basis (Myin-Germeys et al., 2009;Shiffman et al., 2008), and analysed as a network of interacting components (Borsboom et al., 2021).While physiological factors that seem to impact depressive symptoms, like cortisol, can also be examined within these temporal networks, this has never been done before.A recent meta-analysis on associations between salivary cortisol and momentary negative (high cortisol) and positive (low cortisol) affect demonstrated small but significant associations (Joseph et al., 2021).However, the meta-analysis included only three studies, all investigating linear associations, and only one included temporal associations.
In the current study, we used dynamic time warping (DTW) to analyze temporal and non-linear associations.DTW has been more recently proposed for depression research and is an analytical algorithm that can cluster trajectories of individual symptoms based on their shared temporal features (Booij et al., 2021;Hebbrecht et al., 2020).By using DTW, similarities between different time series at both the individual level and at the aggregate group level can be explored.DTW methodology offers the advantage of not being that strictly bound by assumptions about data characteristics such as stationarity and fixed time intervals.It considers non-linear dynamics, with focus on change rather than absolute levels of symptom scores (Booij et al., 2021;Hebbrecht et al., 2020).Yet, further studies are needed to explore how to reliably disentangle within-person and between-person effects using Dynamic Time Warping (DTW) methodology in datasets that included larger number of subjects.Undirected DTW analyses can reveal non-directional associations and may reveal which symptom scores tend to similarly fluctuate in time.Directed DTW analyses may reveal which symptom changes precede similar changes in other symptoms, as a non-linear form of Granger causality testing (Granger, 1969), which reflects primarily the predictive value or forecasting ability of a measure rather than establishing causality itself.It provides insights into the temporal associations between variables by assessing their ability to predict each other's future values.It is important to note that while Granger causality can identify potential predictive relationships, confirming causal effects requires rigorous experimental designs.Symptoms with similar dynamics over time will tend to be more strongly connected as nodes in a network plot with a stronger edge connecting them, compared to symptoms with different dynamics.Specifically, these analyses may reveal how momentary affect and salivary cortisol tend to dynamically interact with each other in time, and whether affect changes precede cortisol changes or vice versa.
In this exploratory proof-of principal study, DTW is used for the first time to analyze EMA affect data in conjunction with cortisol.The current study reanalysed data earlier described by Booij et al. (2016).We analyzed individual data before aggregating them at the group level.This is important as group-level associations do sometimes not reflect associations found within individuals (Fisher et al., 2018;Hekler et al., 2019).We hypothesized, first, with undirected analysis that there would be connectivity between cortisol and negative affect items in time.Since, in depression research the focus lies on the relation of cortisol with negative affect, we did not have any hypothesis regarding positive affect.Second, we expected that positive affect items would cluster together and negative affect items would cluster together, irrespective of the exact items.With the associated higher negative affect levels in depression, and the fact that emotions with similar valence augment each other (Bringmann et al., 2016;Pe and Kuppens, 2012), it is likely that negative affect items are causing or affecting each other, also regarding the network theory of psychopathology (Borsboom, 2017).Third, with directed analysis we hypothesized that cortisol would be connected with negative affect items, with no expectations for the direction.However, given the exploratory nature of this study, we could not accept or reject these hypotheses with a high degree of certainty.

Participants
The sample was drawn from the 'Mood and movement in daily life' (MOOVD) study.The MOOVD study was set up to investigate the dynamic relationship between physical activity and mood in daily life, including the role of some biomarkers.Participants were monitored three times a day for 30 days by means of electronic diaries, actigraphy, and saliva sampling, resulting in a total of 90 measurements per individual and that is up to 30 × 90 = 2700 observations.The depressed participants were recruited from the Psychiatry Department of the University Medical Centre Groningen (UMCG) and from the Centre for Integrative Psychiatry (CIP) in Groningen, The Netherlands.Nondepressed participants were recruited from the general population by means of advertising.The participants were screened with the Beck Depression Inventory (BDI-II), and the BDI score had to be > 14 for inclusion in the depressed group, and < 9 for inclusion in the nondepressed group (Frank et al., 1991).Eligible individuals were first invited to an introduction session and depressed individuals were included if they had a DSM-IV diagnosis of Major Depressive Disorder (current episode or in remission for less than 8 weeks), as confirmed by the Composite International Diagnostic Interview (CIDI) (World Health Organization, 1990).Non-depressed individuals were included without mood disorders at the moment of inclusion.Individuals with a current or recent (within the last two years) diagnosis of a psychotic or bipolar disorder, a chronic somatic illness, or medication use known to influence HPA-axis or the ANS (like, corticosteroids or beta-blockers) were excluded.Use of anti-depressant medication was allowed, despite their assumed influence on psychobiological stress systems (Mason and Pariante, 2006) (see https://doi.org/10.1371/journal.pone.0131002.s002 in (Booij et al., 2015), for an overview of medication/therapy use).Pregnancy and significant hearing of visual impairments were also exclusion criteria (Booij et al., 2015).For the present study, the sample consisted of 30 pair-matched (i.e., 15 depressed and 15 nondepressed) participants of whom saliva samples, that were collected at each assessment, were also analyzed for cortisol levels.A detailed description of the study procedure was given in (Booij et al., 2015).The MOOVD design was approved by the responsible Medical Ethical Committee and all participants provided written consent before inclusion.

Ambulatory sampling
The participants completed questionnaires on an electronic diary, the PsyMate® (PsyMate BV, Maastricht, The Netherlands) for a total of 32 days, whereof the first two days served to get familiar with the device.Assessments were performed three times a day fixed in time with 6 h in between, and adjusted for the chronotype: the regular sleep-wake pattern of the participants.The 6 h interval was set in the original study to capture most of the daily life of the participants.The beeps were planned preferably at the end of the morning, afternoon and evening.The exact timing depended on the sleep-wake schedule assessed by the Munich Chronotype Questionnaire (MCTQ) and a question regarding on what time participants would go to bed.This way individual differences due to circadian phase reduces, since studies demonstrated that there are individual differences in a person's natural sleep-wake rhythm, and the accompanied (phase-locked) hormonal rhythms, such as that of cortisol.On average, the assessments took place during the late morning (≈10:00 a.m.), afternoon (≈4:00 p.m.), and evening (≈10:00 p.m.).There were no significant differences between the depressed and nondepressed groups in terms of the timing at which they completed the daily questionnaires.The diary consisted of 60 items on mood, sleep, cognition and daily activities.PsyMate® generated an alarm 30 min prior to the assessment time to remind participants to refrain from food and drink intake, smoking and brushing teeth until after the assessment was completed.At time of assessment an alarm was set off again and participants were asked to fill out the dairy questions immediately or at least within 1 h.

Salivary cortisol
Salivary samples were collected while completing the diary using Salivettes®.To minimize distorting effects, participants were instructed not to consume any food or beverages (except water), refrain from smoking, or brush their teeth within 30 min prior to saliva sampling.To reinforce compliance with these restrictions, participants were reminded with an extra alarm beep and a text message 30 min before every diary beep.In a previous study, results of dynamic regression models showed that the majority of these violations did not have any significant influence on person-specific cortisol levels (Booij et al., 2015).The participants stored the saliva samples in their refrigerator.If samples were out of refrigerator for more than 4 h this was reported.The samples were collected every week by the research staff and after collection, the samples were centrifuged and stored at − 80 • C until analysis.Analysis was done on 250 µL of saliva with online-solid phase extraction in combination with isotope dilution liquid chromatography-tandem mass spectrometry (LC-MS/MS) and deuterated cortisol was used as internal standard.Samples of one participant were processed in the same batch not in duplicate, as this is not standard procedure with the assessment method LC-MS/MS (van Faassen et al., 2017).Mean intra-and inter-assay coefficients of variation were below 10%.The quantification limit for cortisol was 0.1 nmol L-1.

Momentary affect
Momentary affect was measured with PA and NA items.These items were computed from mood items adopted from (Bylsma et al., 2011).They used some items from the PANAS (Watson et al., 1988) and some additional items.The PA items were: talkative, enthusiastic, self-assured, cheerful, energetic, satisfied, happy, feeling appreciated, relaxed, well concentrated and high interest.The NA items were; feeling tense, anxious, distracted, restless, irritated, depressed, guilty, suicidal thoughts, hopeless, defeated, negative thoughts, worry, slow thoughts and tired.All items were rated on a 7-item Likert scale ranging from 1 'not' through 7 'very', except for item high interest, which ranged from − 3 through + 3.

Statistical analysis
Means with standard deviations (SD) were used to describe the demographic and clinical characteristics.Salivary cortisol levels had a lognormal distribution and were log e -transformed prior analysis.The residuals after adjustment for time of the day within each individual were used in the DTW analyses, as these represent the relative increases and decreases over time within that individual taking the diurnal variation into account.Scores of the PA items were reversed and all parameters were group-level standardized before the DTW analyses, and the edge strengths were re-reverse for the presentation in symptom networks.
We used DTW, which is not a multivariate analysis technique, but a nonlinear shape-based clustering technique that can align different time-series to make them resemble one another.Given that the analysis was designed as a proof-of-principle or exploratory investigation with a primary focus on exploring the relationship of symptoms with salivary cortisol rather than examining the edges between symptoms, we did not adjust for multiple testing.The exploratory nature of this study can therefore only generate hypotheses that will have to be tested in additional studies (Goeman and Solari, 2011).The clustering is accomplished by calculating a minimally warped distance between items.For example, when two affect items share similar dynamics over time, the resulting distance among this affect item pair will be small.These distances of each of the affect and cortisol pairs yield a distance matrix for each participant and from this symptom networks can be derived at individual and group level.For further reading, other studies have previously used the dynamic time warp approach in patients with depression (Booij et al., 2021;Hebbrecht et al., 2020;Mesbah et al., 2023;Slof-Op 't Landt et al., 2022;van Zelst et al., 2022).Additionally, a paper by Giorgino from 2009 describes the dtw package for the R statistical software, including the underlying theory (Giorgino, 2009).
For the undirected analyses, we used the step pattern ''symmetric2′' to calculate the distance matrix and used the global constraint of a ''Sakoe-Chiba'' window size of 1 around main diagonal in the cost matrix.With this window only changes in affect scores that were between plus or minus 1 time point away (1 assessment earlier = lag-1 backward, or 1 assessment later = lag-1 forward) were used (Giorgino, 2009).As a result, items with similar dynamics over time have the best alignment with the smallest distance, resulting in the strongest edges in the network plots.Dissimilar scores at the start and end of each panel data could have a disproportional effect on the total distance, because these cannot be dynamically aligned.To reduce this potential distorting effect, we used interpolation of 5 values between each time point before calculating the distance, which consequently reduced the potentially disrupting effect by 83% of starting and endpoints mismatches but did not affect the relative rank order.The 2 times 15 distance matrices were subsequently analyzed on the group level for the undirected analysis (i.e., nomothetic approach), that yielded the stable part in the similarities of the symptom dynamics between participants.Only the statistically significant edges are shown that were on average shorter than the overall distances among all other items, while we adjusted for the mean symptom level for each of the participants.
For the directed analyses, we used the same DTW algorithm as before, with one crucial difference (see Fig. 1): the window type using the ''Sakoe-Chiba'' band was specified as being asymmetric in order for the dynamic alignment to be only possible in one direction (i.e., forward) in time.The positive relative difference between those two distances will be the final distance (i.e., relative distance from item Pink to item Blue = 0.33 (see Fig. 1E).The higher this outcome is, the stronger the temporal effect of one item to another.Directed analyses were also performed with larger time windows.Time windows 2 and 3 were analysed, which correspond to a time interval of approximately 16 and 24 h (Supplementary Figure 3).
For each of the 30 participants, an undirected and directed distance matrix was calculated, to yield symptom networks, for which we applied similar cut-offs for edges among the participants (i.e., idiographic approach) (Supplementary Figures 1 and 2).For the 2 times 15 grouplevel directed analyses, the edges that were statistically significant different from zero are shown in the two network plots (i.e., nomothetic approach).In all networks the size of the node is proportional to the connectivity of that node.As for the edges, the darkness and thickness are proportional to the strength of the directed effect, only significant (p < 0.05) edges are shown.The mean distances for each of the items and salivary cortisol were calculated using mixed models (with a random slope for the participants), with scores significantly higher than zero indicating high outstrength (nodes that send edges), and scores significantly lower than zero indicating high instrength (nodes that receive edges).

Group characteristics
Demographic and clinical characteristics are presented in Table 1.The mean age of the non-depressed participants was 35.6 ± 8.6 years with 73.3% female.Mean age of the depressed participants was 36.7 ± 10.2 years with also 73.3% female.Mean BDI score of healthy controls at baseline was 2.2 ± 3.1 and 30.8 ± 9.8 for the depressed individuals.

Analyses on individual level (idiographic approach)
We performed undirected and directed DTW analyses to assess whether affect and cortisol interact over time on individual level.The individual networks showed substantial variation between subjects in both groups (Supplementary Fig. 1 and 2).In the undirected analysis cortisol was not connected to any of the affect symptoms in both depressed and non-depressed individuals, signaling less similar dynamics in time than any of the affect symptoms.In directed analyses, however, connections between cortisol and affect symptoms were found.Moreover, the connections between PA symptoms and connections between NA symptoms were positively associated, while connections between PA and NA symptoms showed negative feedback associations in both undirected and directed analysis.The density of the individual networks varied substantially among subjects.Fig. 2 shows an example of two very different networks in non-depressed and depressed individuals for undirected analyses.

Undirected analyses on the group level (nomothetic approach)
Fig. 3 shows the undirected analyses in non-depressed and depressed individuals at the group level.Salivary cortisol was not connected to the affect symptoms in both groups, indicating a difference in dynamic changes from affect during the day.In both groups, PA symptoms (green dots) shared connections with each other as well as the NA symptoms (orange dots), suggesting similar dynamics over time.In neither of the groups connections between PA symptoms and NA symptoms were found.

Directed analyses on the group level (nomothetic approach)
To assess the directionality of connections we performed directed DTW analyses.The network of the control group appeared to be denser compared to the depressed individuals group.Furthermore, different connections were found between the groups (Fig. 4).In controls, changes in salivary cortisol preceded changes in that of NA symptoms ''tiredness'' and ''slow thoughts'': increases in salivary cortisol increased tiredness and slow thoughts.Thus, for two out of fourteen NA symptoms these directed associations were significantly different from zero.In depressed individuals we found no significant outgoing arrows, but only some significant incoming arrows: some affect symptoms changes preceded similar changes in cortisol.An increase in (1 out of 14) NA symptom ''suicidal thought'' preceded an increase in cortisol, while decreases in (2 out of 11) PA symptoms ''feeling appreciated'' and ''happy'' preceded a decrease in cortisol (Fig. 5).This is shown in Fig.
where the mean distance (with 95%CI for the mean) for each of the symptoms and cortisol in both groups is shown.Salivary cortisol tended to have a higher instrength on average in depressed individuals group compared to controls, but this was not significant (p = 0.07).As was expected, connections between pairs of one PA and one NA symptom consisted of negative feedback associations, while all others were positive feedback associations, similar to the findings in undirected analyses.
Directed analyses were also performed with a time window of 2 and 3 measurements, which corresponds to a time interval of approximately 16 and 24 h, respectively.For example, the evening sample of day could then be matched with up to the afternoon or evening sessions of day 2, for the time-window sizes of 2 and 3, respectively.In the depressed individuals the association with PA symptom ''happy'' was no longer statistically significant with the larger time window.For the controls, more outgoing associations from salivary cortisol were found in both time windows, but the association with 'tired' was no longer statistically significant (Supplementary Figure 3).

Discussion
To our knowledge, this is the first study analyzing lagged effects of salivary cortisol and momentary positive and negative affect using DTW in participants diagnosed with a depression and matched non-depressed participants.A first preliminary observation was that individual's networks within the study population varied significantly.Despite the variability at individual level, when analyzed at group level, the connectivity among NA items and among PA items were stronger than those between NA and PA symptoms.Further analysis using directed DTW showed that, while changes in cortisol levels tended to precede changes in specific NA items (such as tiredness) in the control group, this pattern seemed reversed in the group of individuals diagnosed with depression, with salivary cortisol changes appearing to follow changes in specific affect items.Although this result was not statistically significant (p = 0.07).
With the individual networks analysis, we demonstrated high variability among individuals in both groups.Therefore, analyzing individual data before aggregating the results is important because associations between variables was different for each individual, and associations may disappear or even reverse when relationships are only studied at the group level.This could be the case if the associations under study are part of a non-ergodic system (Fisher et al., 2018).Thus, DTW helps to identify whether associations are consistent across Fig. 1.Visualization of the directed dynamic time warp method.Panel A and B show time-series of salivary cortisol and the affect item 'feeling appreciated' with the time and days mentioned on the x-as.To align positive and negative affect items in the same direction, the item scores for feeling appreciated, being a positive affect item, were inverted.Panel A shows alignment of item 1 (cortisol) towards item 22 (feeling appreciated).Panel B shows the inverse alignment where item 'feeling appreciated' is aligned to 'cortisol'.The black lines illustrate the warped (i.e., elastic) modification of one item to get an optimal alignment of one time point after the current assessment.Here the warped modification is the asymmetric ''Sakoe-Chiba'' window size of 1. Panel C shows the cost matrices, which show the optimal warping routes for each of these two calculations, yielding 5.2 and 9.9 as for their respective distances.The positive relative difference between these two distances is the final distance.Panel E show the calculations of the relative distance from 'cortisol' to 'feeling appreciated', which is 0.33, and the inverse: the relative distance from 'feeling appreciated' to 'cortisol' that is − 0.33.The higher this value, the stronger the temporal effect of one item to another.In this case, cortisol had a small temporal effect in predicting the item 'not feeling appreciated', thus 'not feeling appreciated' showed some 'instrength' and 'cortisol' showed some 'outstrength'.different individuals and can help to prevent overlooking relevant patterns in the data.As DTW estimates the distance matrix of each individual as a first step, their findings can be utilized in personalized (psychiatric) care (Hekler et al., 2019).In the last three years, DTW analysis has already been used in depression research in which both individual and group dynamics were captured, and its potential for personalized psychiatric care was suggested (Booij et al., 2021;Hebbrecht et al., 2020).Dynamic networks might be used to predict whether a patient could become (chronically) depressed or is on the brink of a tipping point based on their personal network, which may help to devise preventative actions.
A recent meta-analysis on momentary emotions and salivary cortisol found positive associations among negative emotions and cortisol, and negative associations among positive emotions and cortisol in a healthy sample (Joseph et al., 2021).Findings from lagged analyses on these relationships however are scarce.With DTW we could perform these time-series analyses and demonstrated with directed analysis that changes in salivary cortisol were followed by changes in specific NA items (i.e., slow thoughts and tiredness) in the control group, while in the depressive group changes in NA item (suicidal thoughts) and PA item (happy and feeling appreciated) preceded that of salivary cortisol.While these associations were significant different from zero, comparison of salivary cortisol instrength between controls and depressed individuals was not significant.Some of the findings from previous studies are in line with these preliminary findings.From the meta-analysis mentioned above there were three studies investigating lagged effects.Booij et al., 2016 demonstrated changes in cortisol preceding changes in affect and the other way around in some depressed and non-depressed individuals (Booij et al., 2016).Their dataset was used in the current study, but with a different analytic method.Compared to the latter study, we were able to demonstrate which specific affect items were connected to each other, and how one affect item change preceded that of another and visualize this in a symptom network.A second study investigating lagged effects showed no prior negative emotions association with cortisol in healthy participants (Slatcher et al., 2010).However, these two studies used composites of multiple negative/positive affect instead of individual time-series data of momentary PA and NA (Joseph et al., 2021).With the DTW analysis in the current study, we examined all NA and PA items separately, which makes it possible to look at their dynamic interactions.A third study from the meta-analysis showed that the item sadness tended to predict cortisol at the following timepoint in healthy participants (Hoyt et al., 2016).This is opposite to our preliminary findings in our control participants and more comparable with our preliminary findings in the depressed individuals.However, the time interval of 1 h in the latter study compared to our 6 h is very different, making a direct comparison between the results and conclusions of these two studies difficult.
Although not significant, salivary cortisol had high instrength in the depressed group.It is tempting to speculate that the significant associations we showed indicate that changes in affect could precede that of salivary cortisol.The increases in cortisol due to NA during the day, may cause disruption of the basal secretion that shows a circadian rhythm, resulting in out-of-phase cortisol secretion and this might in turn strengthen the adverse effects of cortisol.The effects of out-of-phase cortisol have been shown in mice studies; In bone tissue, for example, it resulted in an osteoporotic phenotype (Schilperoort et al., 2021), and another mice study demonstrated elevated anxiety, impaired stress coping, and dysfunctional stress-axis regulation in the offspring of pregnant mothers who received out-of-phase glucocorticoids (Astiz et al., 2020).In humans in depression, the out-of-phase effects might thus be caused by NA, and it may worsen the depressive state or symptoms or NA; a vicious cycle.
It has been suggested that depression can be modelled as a complex dynamic system that tend to exhibit critical thresholds (also known as tipping points) at which the system experiences a sudden and dramatic shift from one stable state into another (Cramer et al., 2016;Helmich et al., 2022;Scheffer et al., 2009).Thus, persons may shift from a healthy state into a depressive episode and vice versa.The dynamics of the system of interacting symptoms may be more or less connected, with stronger and more connections resulting in a denser symptom network.Denser networks are usually interpreted as less resilient systems that are able to 'tip over' more easily from a healthy state to a disease state, but also vice versa.This would imply that increase in the connectivity between NA symptoms through various interventions, such as psychotherapy or psychotropic medication, could help the system to move out of the depressed state.Then, once a threshold is exceeded (e.g., due to treatment or oppositely due to adverse events), self-reinforcing (positive) feedback may force the system through a phase transition into an alternative stable state of disease or health.This so called network theory predicts that vulnerability to depression is related to stronger network connectivity (Cramer et al., 2016).As reviewed by Wichers et al., studies on the network connectivity's have reported mixed findings (Wichers et al., 2021) and the only dynamic study did not confirm this theory either.They demonstrated that higher connectivity of the dynamic symptom network was not related with a more persistent psychopathology (Groen et al., 2019).As such, it is of importance to study symptom network density in relation to disorder instability in time (Scheffer et al., 2018).More loose networks may make it harder to There are some limitations that need to be discussed.First, we only included a small sample of 15 individuals in each group, despite the up to 90 assessments per individual.This precluded moderation and mediation analyses.Both the depressed participants and non-depressed participants group consisted mostly of women.The menstrual cycle could potentially have had an impact on the relationship between variables during the assessment period.It is known that hormonal fluctuations can influence mood and various physiological processes (Bouma et al., 2009;Farage et al., 2008).Additionally, our sample was drawn from the MOOVD study that was set up to investigate the dynamic relationship between physical activity and mood.Increases in physical activity are known to be associated with both increases in cortisol as well as in positive affect (Hackney and Walz, 2013;Stavrakakis et al., 2015;Wichers et al., 2012), and could thus also potentially have had an impact on the relationship between variables.Hence, group level results need to be interpreted with care.Second, undirected DTW analyses may not be able to detect relationships of components from different systems.Distances of components from the same system (i.e., mood system) are generally shorter than those across systems (mood system versus endocrine system).As directed analyses involved the relative difference between the distance from one item to another (e.g., from cortisol to a PA symptom, and vice versa), here this limitation does not apply.Lastly,  it is unclear how the 6 h sampling frequency affected the relationship between the variables.The frequency of assessments should be determined based on the assumptions regarding the variability of cortisol and affect items.If assessment intervals are too long compared to the rate of change, results will indicate an incorrect rate of change or specification of the underlying process (Hopwood et al., 2022).For example, it is complex to predict the optimal time course for cortisol changes that would influence momentary affect, given that there are rapid non-genomic effects, but also gene expression changes that peak only hours after activation of glucocorticoid receptors (Meijer et al., 2023;Russell and Lightman, 2019;Wang et al., 2004).In addition, there seems to be time of day variation in mood states, which could also affect associations (Murray et al., 2002;Porto et al., 2006).On the other hand, at the group level the symptom network plots with larger time windows Fig. 4. Directed DTW analyses in non-depressed and depressed participants at the group level.The size of each node is proportional to the connectivity of that node.The darkness and thickness of the edges are proportional to the strength of the directed effect, with only significant (that were significantly different from zero; p < 0.05) edges being shown.Green edges represent positive effects, red edges negative effects.Depressed individuals and controls showed important differences in the aggregated directed network plots.Fig. 5. Forest plots of the directed DTW analysis for salivary cortisol, in 15 non-depressed and in 15 depressed participants, aggregated at the group level through multilevel regression analyses.In controls, changes in cortisol tended to be followed by similar changes in symptom scores of 26 "Slow thoughts" and 18 "Tired".In depressed individuals, changes in symptom scores of 22 "Feeling appreciated", 13 "Happy", and 21 "Suicidal thoughts" tended to be followed by changes in salivary cortisol.
did not show large differences with the symptom network plot of 6 h.
There are also some notable strengths of the study.First, we used DTW as a rather new analytic technique in medical and EMA research to find temporal associations among momentary affect and salivary cortisol, which we could compare among two groups of matched individuals.Second, the number of measurements taken per individual was large, especially when compared to other studies collecting salivary cortisol.Third, we analyzed both undirected and directed relationships.In undirected DTW, the alignment can move in both directions, whereas in directed DTW, the alignment between two time series is constrained to move in one direction.Lastly, to our knowledge we are the first to demonstrate that -next to symptoms and affect states -the temporal dynamics of cortisol, a physiological factor involved in depression, can also be captured with DTW.Furthermore, apart from salivary hormone levels, it is worth exploring the incorporation of series data from immune markers like C-reactive protein into the DTW model.
It is important to emphasize that this study serves as an exploratory concept, demonstrating the potential of DTW as a method to investigate temporal relationships in the context of time series data that integrates both biological and subjective measures.Due to the nature of the nonlinear analysis technique, and the relative low daily sample frequency to pick up circadian rhythm, it is crucial to interpret the results of this study cautiously.Future studies with higher temporal resolution, and possibly larger sample sizes or replication in comparable samples using meta-analysis techniques of single-subject design study findings (Zuidersma et al., 2020) will help validate and build upon the findings of this initial proof-of-principle study.The small sample of 15 individuals per group gives us important knowledge at the individual level, but for aggregated group-level associations future studies on larger samples will indicate the added value of such larger groups.In addition, it is necessary to explore how to reliably disentangle within-person and between-person effects using DTW methodology.Future studies could also investigate temporal dynamics of other hormones and biomarkers involved in the stress response and depression to further unravel all aspects of the disease.Interactions between different hormones may be captured and their associations with symptoms or affect states.Furthermore, with idiographic DTW analysis one may create a personalized network, which includes multimodal components that may underly psychopathology, such as hormone levels, immunomarkers, behavior or affect (Habets et al., 2023).However, it should be noted that these speculations warrant further investigation to establish their validity.

Conclusion
To conclude, this study applied DTW to investigate the temporal dynamics between salivary cortisol levels and momentary affect in individuals diagnosed with depression and control participants.We concluded that, at least on a 6 h interval, at the group level changes in cortisol levels in depression may be a result of affect, rather than a cause.Note that these findings are preliminary and further research is needed to confirm and expand on these conclusions.Furthermore, our measurements were taken with a 6 h time interval, and other studies could investigate shorter lagged effects.Lastly, the large variability in the networks among individuals indicates an important role for personalized medicine.
A.-S.C.A.M.Koning et al.

Fig. 2 .
Fig. 2. Example of individual undirected and directed symptom networks from controls and depressed individuals from the DTW idiographic analyses.Green edges represent positive effects, red edges negative effects.

Fig. 3 .
Fig.3.Undirected DTW analyses in controls and depressed individuals at the group level.The size of each node is proportional to the connectivity of that node.The darkness and thickness of the edges are proportional to the strength of the undirected effect, with only edges shown for which the mean distance was significantly (p < 0.05) smaller than the mean of all remaining distances.

Fig. 6 .
Fig.6.Differences in the mean distance between 15 non-depressed and 15 depressed participants.Error bars represent standard errors, and p-values are group differences among non-depressed and depressed participants.Salivary cortisol tended to have a higher outstrength in controls than in depressed individuals, which approached significance (p = 0.07).

Table 1
Demographic and clinical characteristics.