Digital twins validation

Our restoration analysis predicted which intervention targets (i.e. model parameters) contribute the most to restore healthy frontostriatal functional dynamics, through an efficacy measure (AUC). We test those predictions in the empirical dataset of longitudinal changes in OCD subjects.

Behavioral vs functional improvement in empirical data

First, we assess whether symptoms improvement over time correlate to the restoration of frontostriatal functional connectivity on our empirical dataset of OCD subjects. As in the virtual intervention case, changes in functional connectivity are computed w.r.t. distance to healthy controls connectivity.

OCD_modeling.mcmc.plot_pre_post_dist_ybocs(df_summary, behav='YBOCS_Total', gs=None, args=None)[source]

Plot improvement in behavioral measure of symptoms severity (Y-BOCS) of subjects, and their association to functional improvement (via their distance to healthy functional connectivity).

Parameters:
  • df_summary (pandas.DataFrame) – Summary measures of empirical analysis, inluding subject’s functional connectivity across frontostriatal circuits, behavioral measures (e.g. Y-BOCS score, IQ, etc.), digital pairing and values of the digital twin parameters.

  • gs (matplotlib.Gridspec) – (optional) A GridSpec object that can be used to embbed axes when this figure is a subplot of a larger figure.

  • args (argparse.Namespace) – Extra arguments with options.

_images/YBOCS_FC_corr-01.png

Relation between improvement of functional connectivity distance to healthy controls and symptom severity (Y-BOCS score) in empirical data.

Digital pairing

Then, we paired the initial and follow-up functional connectivity patterns of OCD subjects to the closest baseline and post-intervention simulations. The pairing was based on the Euclidian distance between the empirical functional connectivity value of OCD subjects and their closest simulated connectivity value (i.e. digital twins).

OCD_modeling.mcmc.compute_distances(df_data, df_sims, ses, args)[source]

Compute Euclidian distances between single empirical functional connectivity (FC) and simulated FC.

Parameters:
  • df_data (pandas.DataFrame) – Empirical FC.

  • df_sims (pandas.DataFrame) – Simulated FC.

  • ses (string) – Session (i.e. point in time): initial (“ses-pre”) or follow-up (“ses-post”) appointment.

  • args (argparse.Namespace) – Extra arguments with options.

Returns:

assoc – Unique pairing between individual OCD subjects and simulated subjects (digital twins).

Return type:

dict

Improvement analysis

Once the digital pairing is performed, and we can associate digital twins parameters to empirical subjects improvements in symptoms. We then score which parameter changes covary with improvement in symptoms in our longitudinal dataset of OCD subjetcs, using a dot-product between the two variables.

OCD_modeling.mcmc.score_improvement(df, params, kdes, behav='YBOCS_Total')[source]

Score parameters based on improvement they induce in functional connectivity (FC) space across virtual interventions.

Parameters:
  • df (pandas.DataFrame) – Summary data (empirical data paired with digital twins)

  • params (list) – Individual intervention targets (i.e. model parameters).

  • kdes (dict) – Kernel Density Estimates of posterior distributions of OCD subjects and healthy controls.

  • behav (string) – Behavioral measure. Default: Y-BOCS score.

Returns:

df_improvement – Normalized differences between initial (pre) and follow-up (post) parameters of digital twins for each number of targets in virtual interventions.

Return type:

pandas.DataFrame

OCD_modeling.mcmc.plot_improvement_windrose(df_improvement, params, gs=None, args=None)[source]

Make windrose vizualisation of mean improvement in parameter space.

Parameters:
  • df_improvement (pandas.DataFrame) – Z-score normalized differences between initial (pre) and follow-up (post) parameters of digital twins for number of targets in virtual interventions.

  • params (list) – Individual intervention targets (i.e. model parameters).

  • gs (matplotlib.Gridspec) – (optional) A GridSpec object that can be used to embbed axes when this figure is a subplot of a larger figure.

  • args (argparse.Namespace) – Extra arguments with options.

_images/empirical_params_contrib-02.svg

Normalized changes of parameters between initial (pre) and follow-up (post), scaled by symptoms improvement in digital twins of OCD subjects.

OCD_modeling.mcmc.plot_improvement_pre_post_params_paper(df_summary, params, gs=None, args=None)[source]

Plot initial (pre) and follow-up (post) distributions of parameters from digital twin analysis. (only relevant parameters are shown for manuscript).

Parameters:
  • df_summary (pandas.DataFrame) – Summary measures of empirical analysis, inluding subject’s functional connectivity across frontostriatal circuits, behavioral measures (e.g. Y-BOCS score, IQ, etc.), digital pairing and values of the digital twin parameters.

  • params (list) – Individual intervention targets (i.e. model parameters).

  • gs (matplotlib.Gridspec) – (optional) A GridSpec object that can be used to embbed axes when this figure is a subplot of a larger figure.

  • args (argparse.Namespace) – Extra arguments with options.

_images/empirical_params_changes-02.svg

Distributions of (raw) parameter evolutions between initial (pre) and follow-up (post) in digital twins of OCD subjects.

Personalized interventions

We illustrate how our framework can be used for intervention prognosis using the digital twins. Here we have two OCD subjects, patient #1 and patient #31, for whom we computed digital twins (respectively in green and purple). Model parameters that can be used as intervention targets are on the x-axis while the y-axis denote density estmates of these parameters (blue: controls, orange: OCD; given as reference). Individual values of the two patients are denoted as colorcoded vertical bars, andthe black bar is the target parameter values defined as the avergae healthy parameter value.

Interventions could be planned to restore (i.e. increase or decrease) targeted parameters according to the direction of the colorcoded arrows for each OCD subject, such that their frontostriatal functional connectivity tends to the healthy regime.

_images/kdes_20241112.svg

Digital twin parameters (vertical coloured lines; green: OCD #01, purple: OCD #31) are displayed alongside the control group’s average (black vertical line). Arrows indicate the direction (arrowhead) and amplitude (vector length) of the targeted changes in specific neural parameters to restore healthy neural dynamics at the individual level. Posteriors distributions of OCD (orange) and controls (blue) are shown in background for reference.

To get this, we did a special call to the function below, using the individuals’ digital twins patients summary row (at baseline) as df_real:

OCD_modeling.mcmc.plot_kdes(kdes, cols, df_stats, df_real=[], df_pred=[], plot_args={'col_offset': 3, 'figsize': [10, 7], 'hist_alpha': 0.3, 'kde_alpha': 1, 'ncols': 5, 'nrows': 4, 'row_offset': 2, 'show_stars': True}, args=None)[source]

Plot Kernel Density Estimates of posteriors (controls vs OCD)

Parameters:
  • kdes (dict) – Kernel Density Estimates of parameters

  • cols (list) – Model parameters

  • df_stats (pandas.DataFrame) – Stastics for each parameter (healthy controls vs OCD patients)

  • df_real (pandas.DataFrame) – (Optional) Synthetic data (observed)

  • df_pred (pandas.DataFrame) – (Optional) Synthetic data (predicted)

  • plot_args (dict) –

    Default options for plotting.

    nrows, ncols: number of rows and columns of the GridSpec object (grid of axes). row_offset, col_offset: shifts in rows and colums to let space for another plot. figsize: figure size. show_stars: show stars for statistical significant between controls and OCD. hist_alpha, kde_alpha: opacity of the histograms and kernel density estimates.

  • args (argparse.Namespace) – (Optional) Extra arguments