Home > vbmeg > functions > tool_box > time_frequency > calc_tstat_scl.m

calc_tstat_scl

PURPOSE ^

[t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);

SYNOPSIS ^

function [t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);

DESCRIPTION ^

[t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);
ttest scl1 > scl2
pair_samp  use paired ttest; set to 1  default = 0;

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);
0002 %[t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);
0003 %ttest scl1 > scl2
0004 %pair_samp  use paired ttest; set to 1  default = 0;
0005 %
0006 % Copyright (C) 2011, ATR All Rights Reserved.
0007 % License : New BSD License(see VBMEG_LICENSE.txt)
0008 
0009 if nargin<3
0010    pair_samp=0;
0011 end
0012 
0013 
0014 [dim1,dim2,nmstm_1]=size(scl1);
0015 [dim1,dim2,nmstm_2]=size(scl2);
0016 
0017 t_out=zeros(dim1,dim2);
0018 p_out=ones(dim1,dim2);
0019 
0020 mn1=mean(scl1,3);
0021 mn2=mean(scl2,3);
0022 for i=1:dim1
0023    for j=1:dim2
0024       d1=scl1(i,j,:); 
0025       d2=scl2(i,j,:); 
0026       d1=reshape(d1,nmstm_1,1);
0027       d2=reshape(d2,nmstm_2,1);
0028       in1=d1;
0029       in2=d2;
0030       if pair_samp==1
0031          [t,p]=ttest_pair(d1,d2);
0032       else
0033          [h,p,ci,stats]=ttest2(d1,d2);
0034          t=stats.tstat;
0035       end   
0036       p_out(i,j)=p;
0037       t_out(i,j)=t;
0038    end
0039 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005