%   Identical Twins.
% This data set was discussed in Conover (1999). Twelve pairs of identical
% twins underwent psychological tests to measure the amount of
% aggressiveness in each subject's personality. We are interested in
% comparing the twins to each other to see if the first-born twin
% tends to be more aggressive than the other. The results are as
% follows (the higher score indicates more aggressiveness).
% 
%  First-born twin,    X   86   71  77  68   91   72   77   91   70   71   88  87   
%  Second-born twin, Y   88   77  76  64   96   72   65   90  65   80  81    72 
%  
% 
% The hypotheses are: $H_0:$ the mean aggressiveness scores
% for the two twins are the same, that is,  E(X_i) = E(Y_i), and H_1:
% the first-born twin tends to be more aggressive than the other, i.e.,
%  E(X_i) > E(Y_i). The WSiRT is appropriate if
% we assume that $D_i = X_i - Y_i$ are independent and symmetric. 
% 
   fb = [86 71 77 68 91 72 77 91 70 71 88 87];
   sb = [88 77 76 64 96 72 65 90 65 80 81 72];
   [w1, z1, p] = wsirt(fb, sb, 1)
   

   fb = [86 71 77 68 91 72 77 91 70 71 88 87];
   sb = [88 77 76 64 96 72 65 90 65 80 81 72];
   [T1, p] = wsirtexa(fb, sb, 1)
   
   
   [p h T2] = signrank(fb,sb,'tail','right')     
 
  %walsh
  diff = fb-sb; diff = diff(diff ~= 0);
  comb = combnk(1:length(diff), 2);
  T3 =  sum (diff(comb(:,1))+diff(comb(:,2))  >  0 )+...
            sum(diff>0)

   
   
