Marko
> thanks for the code you posted.
> I tried to run it but ran into a problem with the first variables.
Thanks for helping debug this. Here's the final, fixed version. Let
me know if there's any trouble with it.
-Tom
-- Thomas Nichols -------------------- Department of Biostatistics
http://www.sph.umich.edu/~nichols University of Michigan
[log in to unmask] 1420 Washington Heights
-------------------------------------- Ann Arbor, MI 48109-2029
------- CorrClusTh.m --------
function [k,Pc] =CorrClusTh(SPM,u,alpha)
% function [k,Pc] =CorrClusTh(SPM,u,alpha)
% u - Cluster defining threshold
% SPM - SPM data structure
% alpha - FWE-corrected level (defaults to 0.05)
%
% Finds the corrected cluster size (spatial extent) threshold for a given
% cluster defining threshold u and FWE-corrected level alpha.
%
%_________________________________________________________________________
% $Id: CorrClusTh.m,v 1.2 2005/02/28 19:41:05 nichols Exp $ T Nichols, M Wilke
if nargin<1 | isempty(SPM)
load(spm_get(1,'SPM.mat', 'Select SPM.mat to check'));
end
df = [1 SPM.xX.erdf];
STAT = 'T';
R = SPM.xVol.R;
S = SPM.xVol.S;
if nargin<2 | isempty(u)
u = spm_input(['Cluster defining th. {',STAT,' or p value}'],...
'+0','r',0.001,1);
if u <= 1; u = spm_u(u,df,STAT); end
end
if nargin<3 | isempty(alpha)
alpha = 0.05;
end
u = spm_invTcdf(1-0.01,df(2));
% Repeatedly run these lines with different cluster size thresholds
% until you get the corrected P you want
Pc = 1;
for k = 1:1000
Pc = spm_P(1,k,u,df,'T',R,1,S);
fprintf('k=%d Pc=%g\n',k,Pc)
if Pc <= alpha, break; end
end;
fprintf([' For a cluster-defining threshold of %0.4f the %0.2f-corrected\n'...
' cluster size threshold is %d and has size (corrected P-value)' ...
' %g\n'],u,alpha,k,Pc);
------------------------------
|