**Project Overview:**
---------------------
This page contains data, analysis scripts, and experiment code associated with:
Zhuang, C.^, Meidenbauer, K. L.^, Kardan, O., Stier, A. J., Choe, K. W., Cardenas-Iniguez, C., Huppert, T. J., & Berman, M. G. (2022). Scale invariance in fNIRS as a measurement of cognitive load. *Cortex*, 154, 62–76. https://doi.org/10.1016/j.cortex.2022.05.009
^Authors contributed equally
**Project Components**
----------------------
### Data ###
**Averaged Hurst Exponent Data** contains csv files with H extracted from HbO (*HurstExp_HbO_SNIr.csv*) and HbR (*HurstExp_HbR_SNIr.csv*) after structured noise index (SNI) was regressed out to account for systematic noise across channels. These include Hurst exponent values averaged across all 33 frontal channels.
**For use in PLS analyses** contains the data needed to run Task PLS or Behavioral PLS on Hurst exponent data calculated from HbO or HbR time seires
- *Hurst_HbO_SNIregressed.mat* and *Hurst_HbR_SNIregressed.mat* are Matlab files with data for Hurst exponent data extracted from HbO and HbR separately, includes data for all 52 participants. The analysis script *"create_mats4pls_Hurst.m"* is needed to get the data into the correct format for running PLS
**Misc datafiles** contains two helper files:
- *channels_ROIs.csv* lists the ROIs for each channel (source-detector pair), derived from the Brain AnalyzIR toolbox's depth map function (based on talairach daemon parcellation). This is used to know which channels show significant loadings as defined by bootstrap ratios in the PLS analysis. Note: It is the same file as shared in https://osf.io/sh2bf/
- *hb_SNI_byChannel.mat* has SNI values for each participant by channel and HbO/HbR - this is needed to evaluate data quality in the preprocessing and is used in regressing out SNI values from H data
### Analysis Code ###
**Hurst Calculation & Preprocessing Code** contains Matlab code to run detrended fluctuation analysis (DFA) on the HbO and HbR time series as well as pre-processing and quality checks.
- *Step0_fnirs_analysis_nbdata_preprocess_for_Hurst.m* uses the Brain AnalyzIR toolbox (Santosa et al, 2018: https://github.com/huppertt/nirs-toolbox) to read in the raw data (.nirs files), edit the stimulus info, and convert into optical density then oxy- and deoxy-hemoglobin concentrations. It saves the output of the full HbO and HbR time series as well as stimulus info for use in the code that segments the data and runs the detrended fluctuation analysis (DFA). The raw fnirs data can be accessed in the linked project: Load-Dependent Relationships between Frontal fNIRS Activity and Performance (https://osf.io/sh2bf/)
- Script *Step1_Chunk_main_task.m* and the function it calls (*Step1_chunck_hurst_par_20s.m*) take in the time series data from Step 0, segment it into 20 second chunks of data (last 20 seconds of each task block, the full 20 seconds of each rest block), then run the detrended fluctuations analysis (DFA) on those segments to get Hurst exponent values for each segment for each subject and channel.
- *Step2_SNI_evaluation_exclusion.m* identifies poor quality data at the level of channels and participants based on the structured noise index (SNI) values. It creates plots to visualize the number of "bad" channels and then calculates which channels and participants to exclude based on data quality. Relies on the datafile "hb_SNI_byChannel.mat" which has the SNI values.
- *Step3_Plot_reorganize_data.m* creates plots for visualizing H values
- *Step4_SNI_regress.m* regresses SNI from Hurst exponent data and creates matrices of residuals "Hurst_HbO_SNIregressed.mat" and "Hurst_HbR_SNIregressed.mat" that are needed for the PLS analyses
- *Step5_SNI_stats.m* organizes data and calculates averages across channels, outputs are the CSV files (HurstExp_HbR_SNIr.csv and HurstExp_HbO_SNIr.csv) that are read into Rmarkdown analysis file
- *count_motion_artifacts_forH.m* checks for motion related artifacts in the fNIRS time series and counts them up for comparison across conditions.
- *DFA_parallel2.m* is the code for calculating detrended fluctuation analysis and is called by the Step 1 script. Original code comes from Churchill et al. (2015) and was modified by Omid Kardan.
**Averaged H Statistical Analysis Code** contains the Rmarkdown file (*AvgH_NB_analysis.Rmd*) used to analyze the averaged Hurst exponent values for HbO and HbR by N-back level and for task vs. rest. It also creates the task vs. rest boxplots.
**PLS Analysis Code** contains 2 Matlab scripts needed to run the behavioral analysis
- *createmats4pls.m* takes the subject-level Hurst exponent values after SNI regression (*Hurst_SNIregressed.mat*) and creates the .mat files needed to run PLS
- *Run_PLS_fnirs_nback_Hurst.m* performs the Task PLS analysis using the files generated from createmats4pls.m. It generates the .mat files described in PLS Results and will generate figures for the latent variables
Note: to run PLS, first need to download the PLS code from https://www.rotman-baycrest.on.ca/index.php?section=84
### Results ###
**Averaged H Statistical Analysis Results** contains the Rmarkdown output file *AvgH_NB_analysis.html*, including ANOVA results, t-tests, and plots on averaged H data.
**PLS Results** contains the output from *Run_PLS_fnirs_nback_Hurst.m*
In all cases, the output contains as the latent variable (LV) probabilities, the boostrap ratios (bsrs) for each of the 33 channels eaxmined (see channels_ROIs.csv for cross-reference of channel #s), and a results structure with more detailed PLS output information
- *TaskPLS_fnirs_hbo_Hurst_Nback.mat* is the output from a Task PLS comparing Hurst exponent values across channels by N-back condition for H extracted from the oxyhemoglobin signal
- *TaskPLS_fnirs_hbr_Hurst_Nback.mat* is the output from a Task PLS comparing Hurst exponent values across channels by N-back condition for H extracted from the deoxyhemoglobin signal