Fig. 2.
Example Python code for fitting a fixed effect general linear model of the effect of age on cortical thickness with BrainStat. (A) The MICA-MICS dataset included with BrainStat contains cortical thickness and demographics data. The demographics data contain hashed subject IDs (SUB_ID), visit number (VISIT), z-scored age on the day of scanning (AGE_AT_SCAN), and sex (SEX). (B) We create a linear model in the form of , Note that the intercept is included in the model by default. Third, we initialize the model with an age contrast and request both p-values corrected with random field theory (i.e., “rft”) as well as those corrected for false discovery rate (i.e., “fdr”). Lastly, we fit the model to the cortical thickness data. (C) Negative t-values (blue) indicate decreasing cortical thickness with age, whereas positive t-values (red) depict increasing cortical thickness with age. Significant peak-wise and cluster-wise p-values (p < 0.05) are shown for a random field theory (RFT) correction (cluster defining threshold p < 0.01) as well as vertex-wise p-values (p < 0.05) derived with false discovery rate (FDR) correction. Figure plotting code was omitted for brevity. Python and MATLAB code for this model, as well as code for plotting these figures can be found in the supplemental Jupyter notebook and live script.