Led by the first author Kaat Hebbrecht, we published an open access paper a few days ago on “Understanding personalized dynamics to inform precision medicine: a dynamic time warp analysis of 255 depressed inpatients” in *BMC Medicine*. You can find the full text here.

I briefly summarize the paper in this blog post, given that the paper:

- is primarily the work of a stellar early career researcher
- provides a neat bridge between idiographic (i.e. personalized) and nomothetic (i.e. group-level) data exploration
- is concerned with precision medicine
- is estimated on a rich clinical trial dataset
- features dynamic time warping analysis (DTWA) — a very interesting method many of you may not be familiar with

## Overview

Overall, we used depression symptom data from a clinical routine outcome monitoring study, with assessment points every 2 weeks for a median of 11 weeks (average 5.8 assessments per patient), in 255 depressed inpatients. We present the first implementation of time-series DTWA of depression symptom trajectories, showing how this works both for the intra-individual (i.e., idiographic) and inter-(intra)-individual (i.e., nomothetic) level.

## DTWA

DTWA aims to measure the similarity between two time-series. From our paper: DTWA “uses a dynamic (i.e., stretching and compressing) programming approach to minimize a predefined distance measure (e.g., Euclidean distance), in order for the two time-series to become optimally aligned through a warping path. The “optimal” alignment minimizes the sum of distances between the aligned elements”. The R package dtw can be used for this purpose, and you can find the R script on DTWA here. So overall, we end up knowing how closely correlated the time series of 2 variables is.

## Idiographic analysis

We did this for all item pairs, for each participant. For example, for ID=17, we may find that ‘depressed mood’ and ‘loss of interest’ are strongly aligned, and DTWA provides us with a distance metric for that (how closely they are aligned). We now have a 17 items x 17 items distance matrix for each person. Here is the matrix for 2 patients from our data; smaller distance (in red) means more closely aligned.

We then used cluster analysis to see how, in each person, these distances cluster together. We forced 3 clusters per person to allow some comparability across patients, and to keep the visuals manageable, but of course you would be free to do this analysis in an even more idiographic way and instead use data driven ways to determine clusters:

Here is a plot of the time series of the items for these 2 patients, organized by the 3 clusters per person:

In the last step, we visualized the distance matrices as network, per person; here again for our 2 example patients:

We also describe these 2 patients in some more detail in the paper as case reports.

## Nomothetic analysis

Averaging all of the above across people, we identified 5 clusters of items (although it’s a smooth scree plot, so you could also defend 4 or 6).

We called these dimensions (although there is some subjective interpretation in there for sure):

We then used two different methods to plot the relations among these, with very similar results:

Finally, here are all individual time series of symptoms, along with their reduction over time:

## Treatment implications

We found two further results in the data; these are highly exploratory, of course, so if you have a dataset to replicate these out of sample, that would be really interesting.

First, when splitting the data into patients who showed response or remission (i.e. who got better during treatment) and those who did not improve, we find that the networks estimated on DTWA are more strongly connected in those who got better over time (this is quite a contentious literature, does connectivity predict remission, and there have been results in all sorts of directions, including null findings on this).

Second, we find denser networks in bipolar than unipolar patients.

## Conclusion

Check out the (open access) paper for more details, supplementary materials, and clinical interpretations of the findings. Thanks to Kaat, Erik, and the other coauthors for involving me in paper.

Background: Major depressive disorder (MDD) shows large heterogeneity of symptoms between patients, but within patients, particular symptom clusters may show similar trajectories. While symptom clusters and networks have mostly been studied using cross-sectional designs, temporal dynamics of symptoms within patients may yield information that facilitates personalized medicine. Here, we aim to cluster depressive symptom dynamics through dynamic time warping (DTW) analysis. Methods: The 17-item Hamilton Rating Scale for Depression (HRSD-17) was administered every 2 weeks for a median of 11 weeks in 255 depressed inpatients. The DTW analysis modeled the temporal dynamics of each pair of individual HRSD-17 items within each patient (i.e., 69,360 calculated “DTW distances”). Subsequently, hierarchical clustering and network models were estimated based on similarities in symptom dynamics both within each patient and at the group level. Results: The sample had a mean age of 51 (SD 15.4), and 64.7% were female. Clusters and networks based on symptom dynamics markedly differed across patients. At the group level, five dynamic symptom clusters emerged, which differed from a previously published cross-sectional network. Patients who showed treatment response or remission had the shortest average DTW distance, indicating denser networks with more synchronous symptom trajectories. Conclusions: Symptom dynamics over time can be clustered and visualized using DTW. DTW represents a promising new approach for studying symptom dynamics with the potential to facilitate personalized psychiatric care.

The paper is part of the special issue on complexity in mental health research that Donald Robinaugh and I have been putting together over the last 18 months.

Daniel MoriarityVery neat project! Any suggested readings/guidance to consider in terms of power and stability for these approaches? Have an idea involving substantially fewer nodes (5 or 6) but also fewer follow-ups and greater attrition…

EikoPost authorGood question — not aware of that, but you could bootstrap the core matrix containing the euclidean distances and see how close the estimates are to each other when resampling?