function P = spm_P_Bonf(Z,df,STAT,S,n) % Returns the corrected P value using Bonferroni % FORMAT P = spm_P_Bonf(Z,df,STAT,S,n) % % Z - height {minium over n values} % df - [df{interest} df{error}] % STAT - Statisical feild % 'Z' - Gaussian feild % 'T' - T - feild % 'X' - Chi squared feild % 'F' - F - feild % n - number of conjoint SPMs % S - Voxel count % % P - corrected P value - P(STAT > Z) % %___________________________________________________________________________ % % spm_P_Bonf returns the p-value of Z corrected by the Bonferroni % inequality. % % If abs(n) > 1, a P-value for a minimum of n values of the statistic % is returned. If n>0, the P-value assesses the conjunction null % hypothesis of one or more of the null hypotheses being true. If n<0, % then the P-value assess the global null of all nulls being true. % %___________________________________________________________________________ % @(#)spm_P_Bonf.m 2.3 Thomas Nichols 02/03/08 % $Id: spm_P_Bonf.m,v 1.1 2004/06/30 13:56:28 nichols Exp $ UM Biostat if n>0 Cnj_n = 1; % Inf on Conjunction Null else Cnj_n = abs(n); % Inf on Global Null end if STAT == 'Z' P = 1 - spm_Ncdf(Z); elseif STAT == 'T' P = 1 - spm_Tcdf(Z,df(2)); elseif STAT == 'X' P = 1 - spm_Xcdf(Z,df(2)); elseif STAT == 'F' P = 1 - spm_Fcdf(Z,df); end P = S*P.^Cnj_n; P = min(P,1);