Data Comparisons

This section applies and compares methods on empirical datasets.

Overview

In the previous sections, we have used simulated data to investigate the method properties. While simulated data offers the benefit of knowing ground truth parameters, and systematically exploring variations in isolated parameters, simulation tests are limited to the extent that they do not fully reflect empirical data.

In this section, we compare the methods on empirical data, to examine how they relate to each other in real data cases.

Contents

The following analyses and comparisons are applied to empirical datasets:

  • 31-RestingEEGData: analyzing a small sample of resting state EEG data

    • This dataset is resting state EEG data collected in the VoytekLab

    • Young adult subjects (n=29, ages 18-28), with eyes-closed resting data

  • 32-DevelopmentalEEGData: analyzing a large EEG dataset of developmental data

    • This dataset is the MIPDB dataset, from the ChildMind Institute

    • Cross-sectional developmental data (n=126, ages 6-44), with eyes-open & eyes-closed resting data

  • 33-iEEGData: analyzing a large dataset of intracranial EEG data

    • This dataset is the open iEEG Atlas, from the MNI

    • Clinical iEEG data, cortical electrodes (n=106, average age: 33)

Applied Methods

The following methods are applied to the empirical datasets:

  • SpecParam

  • IRASA

  • Hurst & DFA

  • Lempel-Ziv Complexity

  • Hjorth Complexity

  • Approximate Entropy

Code Approach

The general following strategy is taken:

  • data files are loaded and organized

  • measures of interest are computed on the empirical data

  • results of the measures are compared to each other

The overarching function used to compute measures on data is the run_measures function.

This function allows for:

  • taking a collection of data and a list of methods

  • applying each measure across the data

  • returning the collection of results

# Import the `run_measures` function from the custom code folder
import sys; from pathlib import Path
sys.path.append(str(Path('..').resolve()))
from apm.run import run_measures
# Check the documentation for `run_measures`
print(run_measures.__doc__)
Compute multiple measures of interest across empirical recordings.

    Parameters
    ----------
    data : 2d array
        Data to run measures on, organized as [channels, timepoints].
    measures : dict
        Functions to apply to the data.
        The keys should be functions to apply to the data.
        The values should be a dictionary of parameters to use for the method.

    Returns
    -------
    outputs : dict
        Output measures.
        The keys are labels for each applied method.
        The values are the computed measures for each method.
    

Next, we can run an example of using run_measures.

To do so, we will define an example analysis to apply some measures of interest (here, computing the mean and the variance). To mimic a real dataset, we will use some of the example simulated time series.

import numpy as np

from apm.sim.settings import FS
from apm.sim.examples import SIG_AP, SIG_KN
# Collect together an array of mock data
data = np.array([SIG_AP, SIG_KN])
# Define measures to apply
measures = {
     np.mean : {},
     np.var : {}
}
# Run measures across the data
outputs = run_measures(data, measures)
# Check output values of computed measures
outputs
{'mean': array([-3.03164901e-17,  1.53723552e-14]), 'var': array([1., 1.])}