Cornelius,
> Thanks for the nice work - does this code also work for 2nd level
> analyses (i.e. SPM.mat derived from con-images)?
Yes, it's totally generic, and will work for any T or Z stat image.
> I'm asking because the values CorrClusTh spits out don't fit the
> actual data. I can enter whatever cluster-defining p- or T-value,
> and CCT calculates with T=2.6025....any thoughts?
Ooops! Please delete the line
u = spm_invTcdf(1-0.01,df(2));
(or used the corrected version below). Sorry for the trouble.
-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.3 2005/03/01 17:16:36 nichols Exp $ Thomas Nichols, Marko 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
% 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);
------------------------------
|