def ttest_ind(a, b, axis=0, equal_var=True):
 (a, b, axis) = _chk2_asarray(a, b, axis)
 if ((a.size == 0) or (b.size == 0)):
  return Ttest_indResult(np.nan, np.nan)
 (x1, x2) = (a.mean(axis), b.mean(axis))
 (v1, v2) = (a.var(axis=axis, ddof=1), b.var(axis=axis, ddof=1))
 (n1, n2) = (a.count(axis), b.count(axis))
 if equal_var:
  df = ma.asanyarray(((n1 + n2) - 2.0))
  svar = ((((n1 - 1) * v1) + ((n2 - 1) * v2)) / df)
  denom = ma.sqrt((svar * ((1.0 / n1) + (1.0 / n2))))
 else:
  vn1 = (v1 / n1)
  vn2 = (v2 / n2)
  with np.errstate(divide='ignore', invalid='ignore'):
   df = (((vn1 + vn2) ** 2) / (((vn1 ** 2) / (n1 - 1)) + ((vn2 ** 2) / (n2 - 1))))
  df = np.where(np.isnan(df), 1, df)
  denom = ma.sqrt((vn1 + vn2))
 with np.errstate(divide='ignore', invalid='ignore'):
  t = ((x1 - x2) / denom)
 probs = special.betainc((0.5 * df), 0.5, (df / (df + (t * t)))).reshape(t.shape)
 return Ttest_indResult(t, probs.squeeze())

def ttest_ind ( a , b , axis = 0 , equal_var = True ) : ( a , b , axis ) = _chk2_asarray ( a , b , axis ) if ( ( a . size == 0 ) or ( b . size == 0 ) ) : return Ttest_indResult ( np . nan , np . nan ) ( x1 , x2 ) = ( a . mean ( axis ) , b . mean ( axis ) ) ( v1 , v2 ) = ( a . var ( axis = axis , ddof = 1 ) , b . var ( axis = axis , ddof = 1 ) ) ( n1 , n2 ) = ( a . count ( axis ) , b . count ( axis ) ) if equal_var : df = ma . asanyarray ( ( ( n1 + n2 ) - 2.0 ) ) svar = ( ( ( ( n1 - 1 ) * v1 ) + ( ( n2 - 1 ) * v2 ) ) / df ) denom = ma . sqrt ( ( svar * ( ( 1.0 / n1 ) + ( 1.0 / n2 ) ) ) ) else : vn1 = ( v1 / n1 ) vn2 = ( v2 / n2 ) with np . errstate ( divide = 'ignore' , invalid = 'ignore' ) : df = ( ( ( vn1 + vn2 ) ** 2 ) / ( ( ( vn1 ** 2 ) / ( n1 - 1 ) ) + ( ( vn2 ** 2 ) / ( n2 - 1 ) ) ) ) df = np . where ( np . isnan ( df ) , 1 , df ) denom = ma . sqrt ( ( vn1 + vn2 ) ) with np . errstate ( divide = 'ignore' , invalid = 'ignore' ) : t = ( ( x1 - x2 ) / denom ) probs = special . betainc ( ( 0.5 * df ) , 0.5 , ( df / ( df + ( t * t ) ) ) ) . reshape ( t . shape ) return Ttest_indResult ( t , probs . squeeze ( ) )
ttest independent sample convenience function that uses the classes and throws away the intermediate results .