Home > matlabmk > cmpr_regress_results.m

cmpr_regress_results

PURPOSE ^

function coef_dif=cmpr_regress_results(regress_resultsA,regress_resultsB,group_descr,tail,alpha)

SYNOPSIS ^

function coef_dif=cmpr_regress_results(regress_resultsA,regress_resultsB,group_descr,tail,alpha)

DESCRIPTION ^

function coef_dif=cmpr_regress_results(regress_resultsA,regress_resultsB,group_descr,tail,alpha)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function coef_dif=cmpr_regress_results(regress_resultsA,regress_resultsB,group_descr,tail,alpha)
0002 %function coef_dif=cmpr_regress_results(regress_resultsA,regress_resultsB,group_descr,tail,alpha)
0003 
0004 if nargin<3
0005    error('You need to provide group descriptors!'); 
0006 end
0007 if nargin<4,
0008    tail=0; 
0009 end
0010 if nargin<5,
0011    alpha=.05; 
0012 end
0013 
0014 [n_chanA, n_tptA, n_predA, n_subA]=size(regress_resultsA.sub_coefs);
0015 [n_chanB, n_tptB, n_predB, n_subB]=size(regress_resultsB.sub_coefs);
0016 if (n_chanA~=n_chanB)
0017    error('The number of channels in regress_resultsA and regress_resultsB are not equal.'); 
0018 end
0019 if (n_tptA~=n_tptB)
0020    error('The number of time points in regress_resultsA and regress_resultsB are not equal.'); 
0021 end
0022 if (n_predA~=n_predB)
0023    error('The number of predictors in regress_resultsA and regress_resultsB are not equal.'); 
0024 end
0025 if ~isequal(regress_resultsA.predictor_names,regress_resultsB.predictor_names)
0026    error('The names of predictors in regress_resultsA and regress_resultsB are not equal.');  
0027 end
0028 if ~isequal(regress_resultsA.time_wind,regress_resultsB.time_wind)
0029     error('The time windows in regress_resultsA and regress_resultsB are not equal.');
0030 end
0031 coef_dif.group_descr=group_descr;
0032 coef_dif.sub_coefsA=regress_resultsA.sub_coefs;
0033 coef_dif.sub_coefsB=regress_resultsB.sub_coefs;
0034 coef_dif.mn_dif=zeros(n_chanA,n_tptA,n_predA);
0035 coef_dif.t_dif=zeros(n_chanA,n_tptA,n_predA);
0036 coef_dif.stder_dif=zeros(n_chanA,n_tptA,n_predA);
0037 coef_dif.p_uncor=zeros(n_chanA,n_tptA,n_predA);
0038 coef_dif.p_cor=zeros(n_chanA,n_tptA,n_predA);
0039 coef_dif.h_cor=zeros(n_chanA,n_tptA,n_predA);
0040 coef_dif.predictor_names=regress_resultsA.predictor_names;
0041 coef_dif.participant_filenamesA=regress_resultsA.participant_filenames;
0042 coef_dif.participant_filenamesB=regress_resultsB.participant_filenames;
0043 coef_dif.time_wind=regress_resultsA.time_wind;
0044 coef_dif.family_alpha=alpha;
0045 coef_dif.chanlocs=regress_resultsA.chanlocs;
0046 coef_dif.bins=regress_resultsA.bins;
0047 coef_dif.crctn_method='FDR BH';
0048 
0049 for pred=1:n_predA,
0050     fprintf('Computing between-group difference for predictor: %s\n',coef_dif.predictor_names{pred});
0051     [coef_dif.p_uncor(:,:,pred), coef_dif.t_dif(:,:,pred), ...
0052         coef_dif.mn_dif(:,:,pred), coef_dif.stder_dif(:,:,pred)]=fast_t2(squeeze(regress_resultsA.sub_coefs(:,:,pred,:)), ...
0053         squeeze(regress_resultsB.sub_coefs(:,:,pred,:)),tail,2);
0054     [coef_dif.h_cor(:,:,pred), crit_p, coef_dif.p_cor(:,:,pred)]=fdr_bh(squeeze(coef_dif.p_uncor(:,:,pred)),alpha,'pdep','yes');
0055     h=squeeze(coef_dif.h_cor(:,:,pred));
0056     p_cor=squeeze(coef_dif.p_cor(:,:,pred));
0057     if ~sum(sum(h))
0058         % No significant differences
0059         fprintf('Smallest FDR corrected p-value: %f\n',min(min(p_cor)));
0060     else
0061         % Significant differences
0062         fprintf('Range of significant FDR corrected p-values: %f to %f\n',min(min(p_cor(find(h)))), ...
0063             max(max(p_cor(find(h)))));
0064     end
0065     fprintf('\n');
0066 end
0067 fprintf('\n\n');
0068 
0069 %% Plot Results
0070 %if p.Results.plot_raster,
0071 if 1,
0072     for a=1:n_predA,
0073         fprintf('Plotting raster for predictor: %s\n',coef_dif.predictor_names{a});
0074         sig_raster_dif_coefs(coef_dif,'predictor',a);
0075     end
0076 end

Generated on Tue 10-May-2016 16:37:45 by m2html © 2005