
brandname = [   7   8   4   6   10   10    5   7   9   8  ...
                6   7   8   4    6   10    8   9  ];

generic =[    6   7   5   9   5    5   3    7   5   10  ...
                  8   5   8   4    4    8   6   11   7    5 ...
                  5   5   7   4    6 ];

              xbar1 = mean(brandname)   %7.3333
              xbar2 = mean(generic)     %6.2000

              s1 = std(brandname)       %1.9097
              s2 = std(generic)         %1.9791

              n1 = length(brandname)    %18
              n2 = length(generic)      %25
  %
  sp = sqrt( ((n1-1)*s1^2 + (n2-1)*s2^2)/(n1 + n2 - 2)) % 1.9506
  tL = (xbar1 - xbar2 -(-2))/(sp * sqrt( 1/n1 + 1/n2 )) % 5.1965
  tU = (xbar1 - xbar2 - 2 )/(sp * sqrt( 1/n1 + 1/n2 ))  %-1.4373
  pL = 1-tcdf(tL, n1+ n2  - 2)     %2.9745e-006
  pU = tcdf(tU, n1 + n2 - 2)       %0.0791
  max(pL, pU)                      %0.0791  > 0.05

  alpha = 0.05;
  [xbar1-xbar2 - tinv(1-alpha, n1+n2-2)*sp*sqrt(1/n1+1/n2),...
      xbar1-xbar2 + tinv(1-alpha, n1+n2-2)*sp*sqrt(1/n1+1/n2)]
  %  0.1186    2.1481
  %  (0.1186, 2.1481) not contained in (-2,2)

