Home > marsbar > @mardo > stat_table.m

stat_table

PURPOSE ^

gets Mars statistics and creates statistic table as cell array

SYNOPSIS ^

function [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic)

DESCRIPTION ^

 gets Mars statistics and creates statistic table as cell array
 FORMAT [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic)

 Inputs
 marsD                - MarsBaR design structure
 Ic                   - indices for contrasts to be displayed
 
 Outputs
 rep_strs             - Cell array containing table report
 marsS                - MarsBaR statistics structure
 marsD                - design, including contrast structure (which
                                might have changed)  
 changef              - flag to indicate if design has changed

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic)
0002 % gets Mars statistics and creates statistic table as cell array
0003 % FORMAT [rep_strs, marsS, marsD, changef] = stat_table(marsD, Ic)
0004 %
0005 % Inputs
0006 % marsD                - MarsBaR design structure
0007 % Ic                   - indices for contrasts to be displayed
0008 %
0009 % Outputs
0010 % rep_strs             - Cell array containing table report
0011 % marsS                - MarsBaR statistics structure
0012 % marsD                - design, including contrast structure (which
0013 %                                might have changed)
0014 % changef              - flag to indicate if design has changed
0015 %
0016 % $Id$
0017 
0018 if nargin < 2
0019   Ic = [];
0020 end
0021 
0022 changef = 0;
0023 if isempty(Ic)
0024   [Ic marsD changef] = ui_get_contrasts(marsD,'T|F',Inf,...
0025              'Select contrasts ','',1);
0026 end
0027 
0028 % Do statistics work
0029 [marsS] = compute_contrasts(marsD, Ic);
0030 
0031 % output to text table
0032 if isempty(marsS), return, end
0033 % output column headings
0034 if marsS.rows{1}.stat == 'T'
0035   numstr = 'Contrast value';
0036   statstr = 't statistic';
0037 else
0038   numstr = 'Extra SS';
0039   statstr = 'F statistic';
0040 end
0041 str = sprintf('%-20s%20s:%15s:%15s:%15s:%15s',...
0042           'Contrast name',...
0043           'ROI name',...
0044           numstr,...
0045           statstr,...
0046           'Uncorrected P',...
0047           'Corrected P');
0048 rep_strs{1} = sprintf('\n%s\n%s\n',str, repmat('-',1,length(str)));
0049 
0050 for con = 1:length(marsS.rows)
0051   rep_strs{end+1} = sprintf('%s\n%s\n', ...
0052                 marsS.rows{con}.name,...
0053                 repmat('-',1,42));
0054   for roi = 1:length(marsS.columns)
0055     rep_strs{end+1} = sprintf('%40s:%15.2f:%15.2f:%15.6f:%15.6f\n', ...
0056                  marsS.columns{roi},...
0057                  marsS.con(con,roi),...
0058                  marsS.stat(con,roi),...
0059                  marsS.P(con,roi),...
0060                  marsS.Pc(con,roi));
0061   end
0062 end

Generated on Thu 17-Mar-2016 01:14:46 by m2html © 2005