def ttost_ind(x1, x2, low, upp, usevar='pooled', weights=(None, None), transform=None):
 if transform:
  if (transform is np.log):
   x1 = transform(x1)
   x2 = transform(x2)
  else:
   xx = transform(np.concatenate((x1, x2), 0))
   x1 = xx[:len(x1)]
   x2 = xx[len(x1):]
  low = transform(low)
  upp = transform(upp)
 cm = CompareMeans(DescrStatsW(x1, weights=weights[0], ddof=0), DescrStatsW(x2, weights=weights[1], ddof=0))
 (pval, res) = cm.ttost_ind(low, upp, usevar=usevar)
 return (pval, res[0], res[1])

def ttost_ind ( x1 , x2 , low , upp , usevar = 'pooled' , weights = ( None , None ) , transform = None ) : if transform : if ( transform is np . log ) : x1 = transform ( x1 ) x2 = transform ( x2 ) else : xx = transform ( np . concatenate ( ( x1 , x2 ) , 0 ) ) x1 = xx [ : len ( x1 ) ] x2 = xx [ len ( x1 ) : ] low = transform ( low ) upp = transform ( upp ) cm = CompareMeans ( DescrStatsW ( x1 , weights = weights [ 0 ] , ddof = 0 ) , DescrStatsW ( x2 , weights = weights [ 1 ] , ddof = 0 ) ) ( pval , res ) = cm . ttost_ind ( low , upp , usevar = usevar ) return ( pval , res [ 0 ] , res [ 1 ] )
test of equivalence for two independent samples tost: two one-sided t tests null hypothesis: m1 - m2 < low or m1 - m2 > upp alternative hypothesis: low < m1 - m2 < upp where m1 .