This file is indexed.

/usr/share/octave/packages/nan-3.1.4/ttest2.m is in octave-nan 3.1.4-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
function [h, pval, ci, stats, df] = ttest2 (x, y, alpha, tail, vartype, DIM)
% TTEST2 (unpaired) t-test
%     For two samples x and y from normal distributions with unknown
%     means and unknown equal variances, perform a two-sample t-test of
%     the null hypothesis of equal means.  Under the null, the test
%     statistic T follows a Student distribution with DF degrees of
%     freedom.
%
%     TTEST2 treads NaNs as "Missing values" and ignores these. 
%
% H = ttest2(x,y)
% H = ttest2(x,y,alpha)
% H = ttest2(x,y,alpha,tail)
% H = ttest2(x,y,alpha,tail,vartype)
% H = ttest2(x,y,alpha,tail,vartype,DIM)
% [H,PVAL] = ttest2(...)
% [h,p,ci,stats] = ttest2(...)
%
%     H=1 indicates a rejection of the Null-hypothesis at a significance 
%     level of alpha (default alpha = 0.05).	 
% 
%     With the optional argument string TAIL, the Alternative of interest
%     can be selected.  If TAIL is '!=' or '<>' or 'both', the null is tested
%     against the two-sided Alternative `mean (X) ~= mean (Y)'.  If TAIL
%     is '>' or 'right', the one-sided Alternative `mean (X) > mean (Y)' is used.
%     Similarly for '<' or 'left', the one-sided Alternative `mean (X) < mean
%     (Y)' is used.  The default is the two-sided case.
% 
%     vartype support only 'equal' (default value); the value 'unequal' is not supported. 
%
%     H returns whether the Null-Hypotheses must be rejected. 
%     The p-value of the test is returned in PVAL. 
% 
%     TTEST2 works on the first non-singleton dimension or on DIM. 
%
%     If no output argument is given, the p-value of the test is
%     displayed.
%

%%% not supported yet 
% [h,p,ci] = ttest2(...)
% [h,p,ci,stats] = ttest2(...)

%       $Id$
%       Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2005, 2006, 2007
%               Kurt Hornik
%       Copyright (C) 2010 by Alois Schloegl <alois.schloegl@gmail.com>	
%       This function is part of the NaN-toolbox
%       http://pub.ist.ac.at/~schloegl/matlab/NaN/

%    This program is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.

  if ((nargin < 2) || (nargin > 6) || nargout > 4)
        print_usage ;
  end

  if (nargin < 3) || isempty(alpha)
    alpha = .05;
  end

  if (nargin < 4) || isempty(tail)
    tail = '~=';
  end
  if (~ ischar (tail))
    error ('ttest2: tail must be a string');
  end
  if (nargin < 5) || isempty(vartype)
    vartype = 'equal';
  end
  if ~strcmp(vartype,'equal')
    error ('test: vartype not supported')
  end	
  if nargin<6,
       DIM = find(size(x)>1,1);
  end;
  if isempty(DIM), DIM=1; end;

  szx = size(x); 
  szy = size(y);	
  szy(DIM) = 1;	  
  szx(DIM) = 1;
  
  if (any(szx-szy))
    error ('ttest2: dimension of X and Y do not fit');
  end

  [SX, NX] = sumskipnan(x, DIM);
  [SY, NY] = sumskipnan(y, DIM);
  stats.df = NX + NY - 2;
  MX = SX ./ NX;
  MY = SY ./ NY;

  if any(size(x)==0) || any(size(y)==0)
  	v = NaN;
  else	
  	v = sumsq(x-repmat(MX,size(x)./size(MX))) + sumsq(y-repmat(MY,size(y)./size(MY)));
  end; 	
  stats.sd    = sqrt(v/stats.df);
  stats.tstat = (MX - MY) .* sqrt ((NX .* NY .* stats.df) ./ (v .* (NX + NY)));
  cdf         = tcdf (stats.tstat, stats.df);

  if (strcmp (tail, '~=') || strcmp (tail, '!=') || strcmp (tail, '<>')) || strcmp(tail,'both'),
    pval = 2 * min (cdf, 1 - cdf);
  elseif strcmp (tail, '>') || strcmp(tail,'right'),
    pval = 1 - cdf;
  elseif strcmp (tail, '<') || strcmp(tail,'left'),
    pval = cdf;
  else
    error ('ttest2: option %s not recognized', tail);
  end

  h = pval < alpha;	

  if (nargout == 0)
    fprintf(1,'  pval: %g\n', pval);
  end