compute and return stats FORMAT marsS = compute_contrasts(marsDe, Ic) marsDe - design object Ic - indices into contrast structure Output marsS - statistic result structure For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices with one row per contrast, one column per ROI estimated The statistics results structure has fields 'con' - contrast value (numerator of t statistic, or ESS for F) 'stat' - t or F statistic value 'P' - uncorrected P value 'Pc' - P values corrected for number of ROIs 'MVres' - multivariate results structure with fields 'y_pre' - predicted temporal response 'y_obs' - observerd temporal response 'Pf' - probabability for last (rank of subspace) eigenvalues 'u' - principle components 'ds' - component weights (diag(S)) 'df' - degrees of freedom for Pf 'columns' - names of regions 'rows' - cell array of structs, one per contrast calculated, with fields: 'name' - contrast name 'stat' - statistic type (T|F) $Id$
0001 function [marsS] = compute_contrasts(marsDe, Ic) 0002 % compute and return stats 0003 % FORMAT marsS = compute_contrasts(marsDe, Ic) 0004 % 0005 % marsDe - design object 0006 % Ic - indices into contrast structure 0007 % 0008 % Output 0009 % marsS - statistic result structure 0010 % 0011 % For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices 0012 % with one row per contrast, one column per ROI estimated 0013 % 0014 % The statistics results structure has fields 0015 % 'con' - contrast value (numerator of t statistic, or ESS for F) 0016 % 'stat' - t or F statistic value 0017 % 'P' - uncorrected P value 0018 % 'Pc' - P values corrected for number of ROIs 0019 % 'MVres' - multivariate results structure with fields 0020 % 'y_pre' - predicted temporal response 0021 % 'y_obs' - observerd temporal response 0022 % 'Pf' - probabability for last (rank of subspace) 0023 % eigenvalues 0024 % 'u' - principle components 0025 % 'ds' - component weights (diag(S)) 0026 % 'df' - degrees of freedom for Pf 0027 % 'columns' - names of regions 0028 % 'rows' - cell array of structs, one per contrast calculated, 0029 % with fields: 0030 % 'name' - contrast name 0031 % 'stat' - statistic type (T|F) 0032 % 0033 % $Id$ 0034 0035 SPM = des_struct(marsDe); 0036 xCon = SPM.xCon; 0037 0038 if nargin < 2 0039 Ic = 1:length(xCon); 0040 end 0041 0042 %- results 0043 0044 [marsS.con marsS.stat, marsS.P, marsS.Pc] = ... 0045 pr_stat_compute(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ... 0046 SPM.betas, SPM.ResidualMS); 0047 marsS.MVres = pr_stat_compute_mv(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ... 0048 SPM.betas, SPM.ResidualMS, ... 0049 summary_data(SPM.marsY)); 0050 0051 marsS.columns = region_name(SPM.marsY); 0052 for i = 1:length(Ic) 0053 marsS.rows{i}.name = xCon(Ic(i)).name; 0054 marsS.rows{i}.stat = xCon(Ic(i)).STAT; 0055 end 0056