spm_P.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. function [P,p,Ec,Ek] = spm_P(c,k,Z,df,STAT,R,n,S)
  2. % Return the [un]corrected P value using unified EC theory
  3. % FORMAT [P,p,Ec,Ek] = spm_P(c,k,Z,df,STAT,R,n,S)
  4. %
  5. % c - cluster number
  6. % k - extent {RESELS}
  7. % Z - height {minimum over n values}
  8. % df - [df{interest} df{error}]
  9. % STAT - Statistical field
  10. % 'Z' - Gaussian field
  11. % 'T' - T - field
  12. % 'X' - Chi squared field
  13. % 'F' - F - field
  14. % 'P' - Posterior probability
  15. % R - RESEL Count {defining search volume}
  16. % n - number of component SPMs in conjunction
  17. % S - Voxel count
  18. %
  19. % P - corrected P value - P(C >= c | K >= k}
  20. % p - uncorrected P value
  21. % Ec - expected total number of clusters
  22. % Ek - expected total number of resels per cluster
  23. %
  24. %__________________________________________________________________________
  25. %
  26. % spm_P determines corrected and uncorrected p values, using the minimum
  27. % of different valid methods.
  28. %
  29. % See also: spm_P_RF, spm_P_Bonf
  30. %__________________________________________________________________________
  31. % Copyright (C) 2001-2011 Wellcome Trust Centre for Neuroimaging
  32. % Thomas Nichols
  33. % $Id: spm_P.m 4419 2011-08-03 18:42:35Z guillaume $
  34. if nargin < 8, S = []; end
  35. [P,p,Ec,Ek] = spm_P_RF(c,k,Z,df,STAT,R,n);
  36. % Compare with Bonferroni P value (if possible)
  37. %--------------------------------------------------------------------------
  38. if ~isempty(S) && (c == 1 && k == 0) && ~isequal(R, 1)
  39. P = min(P, spm_P_Bonf(Z,df,STAT,S,n));
  40. end