Dear Denise,
maybe the code below is of some help for you. You can convert t-values to
correlation coefficient, effect size, p-values or log p-values. It should
work for SPM2 and SPM99.
Best regards,
Christian
--
____________________________________________________________________________
Christian Gaser, Ph.D.
Department of Psychiatry
Friedrich-Schiller-University of Jena
Philosophenweg 3, D-07743 Jena, Germany
Tel: ++49-3641-935805 Fax: ++49-3641-935280
e-mail: [log in to unmask]
http://dbm.neuro.uni-jena.de
------------------------------------------------------------------------------------------------------------
function r = cg_t2x
%CG_T2X transformation of t-maps to P, -log(P), r or d-maps
%
% The following formulas are used:
%
% --------------------------------
% correlation coefficient:
% --------------------------------
% 1
% r = ------------------
% n-2
% sqrt(------ + 1)
% sqr(t)
%
% --------------------------------
% effect-size
% --------------------------------
% 2r
% d = ----------------
% sqrt(1-sqr(r))
%
% --------------------------------
% p-value
% --------------------------------
%
% p = 1-spm_Tcdf
%
% --------------------------------
% log p-value
% --------------------------------
%
% -log10(1-P) = -log(1-spm_Tcdf)
%
% For the last case of log transformation this means that a p-value of
p=0.99 (0.01)
% is transformed to a value of 2
%
% Examples:
% p-value -log10(1-P)
% 0.1 1
% 0.05 1.3
% 0.01 2
% 0.001 3
% 0.0001 4
%
%_______________________________________________________________________
% @(#)cg_t2x.m 1.2 Christian Gaser 2004/05/19
P = spm_get(Inf,'spmT*.img','Select result image(s)');
sel = spm_input('Convert t value to?',1,'m',...
'1-p|-log(1-p)|correlation coefficient cc|effect size d',[1 2 3 4], 2);
for i=1:size(P,1)
Res = deblank(P(i,:));
[pth,nm,xt,vr] = fileparts(Res);
SPM_name = fullfile(pth, ['SPM.mat' vr]);
% SPM.mat exist?
try
load(SPM_name);
spm_mat = 1;
catch
spm_mat = 0;
end
if spm_mat
if strcmp(spm('ver'),'SPM2')
xCon = SPM.xCon;
df = SPM.xX.erdf;
else
xCon_name = fullfile(pth, ['xCon.mat' vr]);
load(xCon_name);
df = xX.erdf;
end
else
df = spm_input('df ?',1,'e');
end
switch sel
case 1
t2x = ['1-spm_Tcdf(i1,' num2str(df) ')'];
nm2 = 'P';
case 2
t2x = ['-log10(max(eps,1-spm_Tcdf(i1,' num2str(df) ')))'];
nm2 = 'logP';
case 3
t2x = ['sign(i1).*(1./((' num2str(df) './((i1.*i1)+eps))+1)).^0.5'];
nm2 = 'R';
case 4
tmp = ['((' num2str(df) './((i1.*i1)+eps))+1)'];
t2x = ['2./((1-(1./' tmp ')).*' tmp ').^0.5'];
nm2 = 'D';
end
% name should follow convention spm?_0*.img
if strcmp(nm(1:3),'spm') & strcmp(nm(5:7),'T_0')
num = str2num(nm(length(nm)-2:length(nm)))
if xCon(num).STAT ~= 'T'
error('Not a T contrast');
end
out = fullfile(pth,[nm(1:3) nm2 nm(5:end) xt vr]);
else
out = fullfile(pth,['spm' nm2 '_' nm xt vr]);
end
spm_imcalc_ui(Res,out,t2x,{0 0 4 1});
end
------------------------------------------------------------------------------------------------------------
On Wed, 2 Feb 2005 14:20:11 +0100, =?ISO-8859-1?Q?Denise_D=F6rfel?=
<[log in to unmask]> wrote:
>Hi SPM users,
>
>I did a correlation analysis between the activation of a contrast and
>the score of a questionnaire.
>Is it possible to show the correlation coefficient or to get it out of SPM2?
>
>In general, how can I get infos like this out of SPM2?
>
>Thanks in advance.
>Denise Dörfel.
>
>--
>Denise Doerfel
>Dipl.-Psych.
>
>Biopsychology
>University of Technology Dresden
>Zellescher Weg 17
>01069 Dresden
>Germany
>
>Tel.: 0049 - 351 - 463 33708
>Fax.: 0049 - 351 - 463 37274
>mail: [log in to unmask]
>http://biopsychologie.tu-dresden.de
|