help
help > RE: first level threshold
Oct 24, 2011 02:10 AM | Alfonso Nieto-Castanon - Boston University
RE: first level threshold
Hi Sarah,
One simple general way I could recommend to obtain seed-to-voxel first-level connectivity maps corrected for multiple comparisons would be to use Fisher approximation to the standard error of correlation coefficient estimates to obtain first uncorrected p-values for each voxel, and then apply an FDR-correction to obtain FDR-corrected p-values. The simplest way to approximate the standard error of the seed-to-voxel correlations would be assuming non-colored noise over the (typically small) frequency band defined during the preprocessing step (this is the same approach used by the previous version of the toolbox when using fixed-effect analyses; alternatively you could also use Welch-Satterthwaite approximation for a more precise result but that would require estimating the spectra of the residuals first).
In any way, if you have already run the setup/preprocessing/first-level analyses (and obtained in this way fisher-transformed BETA_Subject*_Condition*_Source*.nii files; one map for each source/condition/subject), you could easily transform these files to the associated uncorrected and FDR-corrected p-values (following the approach described above) using the following script:
nsub=1; % subject number
ncondition=1; % condition number
nroi=1; % source/seed number
nanalysis=1; % analysis number
global CONN_x;
filepath=CONN_x.folders.preprocessing;
filepathresults=fullfile(CONN_x.folders.firstlevel,CONN_x.Analyses(nanalysis).name);
filename=fullfile(filepath,['DATA_Subject',num2str(nsub,'%03d'),'_Condition',num2str(ncondition,'%03d'),'.mat']);
Y=conn_vol(filename);
DOF=max(0,Y.size.Nt*(min(1/(2*CONN_x.Setup.RT),CONN_x.Preproc.filter(2))-max(0,CONN_x.Preproc.filter(1)))*(2*CONN_x.Setup.RT)+1);
filename=fullfile(filepathresults,['BETA_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
a=spm_vol(filename);
Z=spm_read_vols(a); % fisher-transformed correlation values
z=Z*max(0,sqrt(DOF-3)); % z-scores
p=spm_Ncdf(z); % p-values from normal distribution
p=2*min(p,1-p); % note: two-sided tests (remove this line for one-sided tests; i.e. only positive correlations)
P=p;
P(:)=conn_fdr(p(:)); % FDR-corrected p-values
a.fname=fullfile(filepathresults,['p_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
spm_write_vol(a,p);
a.fname=fullfile(filepathresults,['pFDR_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
spm_write_vol(a,P);
This will create two files:
p_Subject1_Condition1_Source1.nii
pFDR_Subject1_Condition1_Source1.nii
with the uncorrected and FDR-corrected p-values, respectively, of the seed-to-voxel maps for the first subject/condition/source (edit the first four lines to change the subject/condition/source numbers of interest)
Hope this helps, and let me know if this addresses your question. You might need to do something more complex if you want to look instead at more complex contrasts across conditions or sources, let me know.
Best
Alfonso
Originally posted by Sarah Buetof:
One simple general way I could recommend to obtain seed-to-voxel first-level connectivity maps corrected for multiple comparisons would be to use Fisher approximation to the standard error of correlation coefficient estimates to obtain first uncorrected p-values for each voxel, and then apply an FDR-correction to obtain FDR-corrected p-values. The simplest way to approximate the standard error of the seed-to-voxel correlations would be assuming non-colored noise over the (typically small) frequency band defined during the preprocessing step (this is the same approach used by the previous version of the toolbox when using fixed-effect analyses; alternatively you could also use Welch-Satterthwaite approximation for a more precise result but that would require estimating the spectra of the residuals first).
In any way, if you have already run the setup/preprocessing/first-level analyses (and obtained in this way fisher-transformed BETA_Subject*_Condition*_Source*.nii files; one map for each source/condition/subject), you could easily transform these files to the associated uncorrected and FDR-corrected p-values (following the approach described above) using the following script:
nsub=1; % subject number
ncondition=1; % condition number
nroi=1; % source/seed number
nanalysis=1; % analysis number
global CONN_x;
filepath=CONN_x.folders.preprocessing;
filepathresults=fullfile(CONN_x.folders.firstlevel,CONN_x.Analyses(nanalysis).name);
filename=fullfile(filepath,['DATA_Subject',num2str(nsub,'%03d'),'_Condition',num2str(ncondition,'%03d'),'.mat']);
Y=conn_vol(filename);
DOF=max(0,Y.size.Nt*(min(1/(2*CONN_x.Setup.RT),CONN_x.Preproc.filter(2))-max(0,CONN_x.Preproc.filter(1)))*(2*CONN_x.Setup.RT)+1);
filename=fullfile(filepathresults,['BETA_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
a=spm_vol(filename);
Z=spm_read_vols(a); % fisher-transformed correlation values
z=Z*max(0,sqrt(DOF-3)); % z-scores
p=spm_Ncdf(z); % p-values from normal distribution
p=2*min(p,1-p); % note: two-sided tests (remove this line for one-sided tests; i.e. only positive correlations)
P=p;
P(:)=conn_fdr(p(:)); % FDR-corrected p-values
a.fname=fullfile(filepathresults,['p_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
spm_write_vol(a,p);
a.fname=fullfile(filepathresults,['pFDR_Subject',num2str(nsub),'_Condition',num2str(ncondition,'%03d'),'_Source',num2str(nroi,'%03d'),'.nii']);
spm_write_vol(a,P);
This will create two files:
p_Subject1_Condition1_Source1.nii
pFDR_Subject1_Condition1_Source1.nii
with the uncorrected and FDR-corrected p-values, respectively, of the seed-to-voxel maps for the first subject/condition/source (edit the first four lines to change the subject/condition/source numbers of interest)
Hope this helps, and let me know if this addresses your question. You might need to do something more complex if you want to look instead at more complex contrasts across conditions or sources, let me know.
Best
Alfonso
Originally posted by Sarah Buetof:
Hi Alfonso,
Thanks for your quick answer.
We are planning to use the first level r-maps in another analysis and they should be corrected for multiple comparisons.
The fixed-effect analysis in 12 does not work and I get following error message:
Step 1/2: Functional data second-level analyses
62.5% ??? Reference to non-existent field 'csources'.
Error in ==> conn_process at 1467
csources=SPMall(n1).connvols.csources;
Error in ==> conn_process at 18
case 'results', conn_process(14:15,varargin{:});
Error in ==> conn at 1601
conn_process('results');
Error in ==> conn_menumanager at 112
feval(MM.MENU{n0}.callback{n1}{1},MM.MENU{n0}.callback{n1}{2:end});
??? Error while evaluating figure WindowButtonUpFcn
Somebody else already mentioned that error and you provided another conn_process.m file that should solve the problem. But that didn't work for me, too.
We could implement a threshold in the script for our further analysis, but therefore we need the p-values.
Do you have any suggestions how to deal with that issue?
Does it makes more sense to try to fix the problem with version 12 or to do the statitics with matlab with the 13-results? Since I am not very familiar with matlab yet, I would prefer the first way, if that provides the results I am looking for.
Thanks
Thanks for your quick answer.
We are planning to use the first level r-maps in another analysis and they should be corrected for multiple comparisons.
The fixed-effect analysis in 12 does not work and I get following error message:
Step 1/2: Functional data second-level analyses
62.5% ??? Reference to non-existent field 'csources'.
Error in ==> conn_process at 1467
csources=SPMall(n1).connvols.csources;
Error in ==> conn_process at 18
case 'results', conn_process(14:15,varargin{:});
Error in ==> conn at 1601
conn_process('results');
Error in ==> conn_menumanager at 112
feval(MM.MENU{n0}.callback{n1}{1},MM.MENU{n0}.callback{n1}{2:end});
??? Error while evaluating figure WindowButtonUpFcn
Somebody else already mentioned that error and you provided another conn_process.m file that should solve the problem. But that didn't work for me, too.
We could implement a threshold in the script for our further analysis, but therefore we need the p-values.
Do you have any suggestions how to deal with that issue?
Does it makes more sense to try to fix the problem with version 12 or to do the statitics with matlab with the 13-results? Since I am not very familiar with matlab yet, I would prefer the first way, if that provides the results I am looking for.
Thanks
Threaded View
Title | Author | Date |
---|---|---|
Sarah Buetof | Oct 18, 2011 | |
Alfonso Nieto-Castanon | Oct 18, 2011 | |
Sarah Buetof | Oct 19, 2011 | |
Alfonso Nieto-Castanon | Oct 24, 2011 | |
Kaitlin Cassady | Sep 17, 2019 | |
Kaitlin Cassady | Oct 4, 2019 | |
Bastien Guerin | Feb 6, 2019 | |
Matthew Heard | Jan 22, 2019 | |
Erin Mazerolle | Jan 17, 2014 | |
Sarah Buetof | Oct 31, 2011 | |