Tutorial stats 011422

From MEG Core
Jump to navigation Jump to search


Tutorial Session

Recording Download: MNE & AFNI Group Analysis Tutorial (mp4)

Afni Prep

Install Afni on computer:


Statistical Processing in AFNI

 #! /bin/bash
 # First things first: Good practice to convert .nii files to afni .HEAD .BRIK format:  3dcopy mydataset.nii myafnidataset
 # Here the data have been converted to common space (+tlrc) but if not can be done in afni with adwarp
 # Example: One Sample T-test on alpha band log ratio of face power and shape power
 # Why log-ratio? log(faces/shapes) = log(faces) - log(shapes) ; log attentuates outliers , normalizes distribution. 
 # First make a list of subjects for test: 
 ls *_7_13_*lograt*.HEAD > alpha_list
 # Then run one sample T-test
 3dttest++ -setA `cat alpha_list` -prefix alpha_ttest
 # Optional: add effect size to output
 3dMean -prefix alpha_mean `cat alpha_list`
 3dMean -sd -prefix alpha_std `cat alpha_list`
 3dcalc -prefix alpha_effectsize -a alpha_mean+tlrc -b alpha_std+tlrc -expr 'a/b'
 3dbucket -prefix alpha_ttest_effectsize alpha_ttest+tlrc alpha_effectsize+tlrc
 3drefit -sublabel 2 "effectsize" alpha_ttest_effectsize+tlrc
 # Could do a paired T-test between faces and shapes instead of log-ratio
 ls *_7_13_*shape*.HEAD > alpha_shape_list
 ls *_7_13_*face*.HEAD > alpha_face_list
 3dttest++ -setA `cat alpha_face_list` -setB `cat alpha_shape_list` -paired -prefix alpha_paired_ttest
 # Can add covariates to T-tests. 
 # Can do mixed-effects ANOVAs and other fancier stuff

MNE Python

Install MNE Python

 conda install mamba -y
 mamba create -n tutorial_stats conda-forge::mne conda-forge::datalad -y
 conda activate tutorial_stats

Download the data

Will Update soon with appropriate paths etc.

 git clone ------- data repo
 cd ----
 datalad get ./*

Additional MEG Stats Links