Difference between revisions of "Tutorial stats 011422"

From MEG Core
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
=!!UNDER CONSTRUCTION!!=
 
=!!UNDER CONSTRUCTION!!=
  +
  +
== Tutorial Session ==
  +
Recording Download: [https://megcore.nih.gov/MEG/ClubMEG_Carver&Stout_MNE&AFNI-GroupAnalysisTutorial_012122.mp4 MNE & AFNI Group Analysis Tutorial (mp4)]
   
 
== Afni Prep ==
 
== Afni Prep ==
 
=== Install Afni on computer: ===
 
=== Install Afni on computer: ===
 
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/index.html
 
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/index.html
  +
  +
=== 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 ==
 
== MNE Python ==
Line 10: Line 41:
 
mamba create -n tutorial_stats conda-forge::mne conda-forge:datalad -y
 
mamba create -n tutorial_stats conda-forge::mne conda-forge:datalad -y
 
conda activate tutorial_stats
 
conda activate tutorial_stats
  +
   
 
=== Download the data ===
 
=== Download the data ===
  +
Will Update soon with appropriate paths etc.
 
git clone ------- data repo
 
git clone ------- data repo
 
cd ----
 
cd ----
 
datalad get ./*
 
datalad get ./*
  +
  +
=== Additional MEG Stats Links ===
  +
https://mne.tools/stable/auto_tutorials/stats-sensor-space/10_background_stats.html
  +
https://eelbrain.readthedocs.io/en/stable/getting_started.html
  +
https://neuroimage.usc.edu/brainstorm/Tutorials/Statistics
  +
https://www.fieldtriptoolbox.org/tutorial/eventrelatedstatistics/

Latest revision as of 17:58, 24 January 2022

!!UNDER CONSTRUCTION!!

Tutorial Session

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

Afni Prep

Install Afni on computer:

 https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/index.html

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

 https://mne.tools/stable/auto_tutorials/stats-sensor-space/10_background_stats.html
 https://eelbrain.readthedocs.io/en/stable/getting_started.html
 https://neuroimage.usc.edu/brainstorm/Tutorials/Statistics
 https://www.fieldtriptoolbox.org/tutorial/eventrelatedstatistics/