forked from neurodebian/spm8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spm_P.m
53 lines (47 loc) · 1.68 KB
/
spm_P.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function [P,p,Ec,Ek] = spm_P(c,k,Z,df,STAT,R,n,S)
% Returns the [un]corrected P value using unifed EC theory
% FORMAT [P p Ec Ek] = spm_P(c,k,Z,df,STAT,R,n,S)
%
% c - cluster number
% k - extent {RESELS}
% Z - height {minimum over n values}
% df - [df{interest} df{error}]
% STAT - Statistical field
% 'Z' - Gaussian field
% 'T' - T - field
% 'X' - Chi squared field
% 'F' - F - field
% 'P' - Posterior probability
% R - RESEL Count {defining search volume}
% n - number of component SPMs in conjunction
% S - Voxel count
%
% P - corrected P value - P(C >= c | K >= k}
% p - uncorrected P value
% Ec - expected total number of clusters
% Ek - expected total number of resels per cluster
%
%__________________________________________________________________________
%
% spm_P determines corrected and uncorrected p values, using the minimum
% of different valid methods.
%
% See the individual methods for details
%
% spm_P_RF
% spm_P_Bonf
%
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Thomas Nichols
% $Id: spm_P.m 3824 2010-04-19 19:23:35Z karl $
% set global var NOBONF to 1 to turn off Bonferroni
%--------------------------------------------------------------------------
global NOBONF; if ~isempty(NOBONF) && NOBONF, S = []; end
if nargin < 8, S = []; end
[P,p,Ec,Ek] = spm_P_RF(c,k,Z,df,STAT,R,n);
% Use lower Bonferroni P value (if possible)
%==========================================================================
if ~isempty(S) && (c == 1 && k == 0) && ~(length(R) == 1 && R == 1)
P = min(P,spm_P_Bonf(Z,df,STAT,S,n));
end