由stats.ttest_ind计算时的错误p值

时间:2017-07-06 12:57:03

标签: python scipy statistics p-value

我试图计算两个pandas系列的p值 - Ref_for_avg和CNOGA_for_avg。我还计算了两个系列的均值和标准。均值和标准计算是正确的,但由于某种原因,在同一2系列上计算的p值不正确。

我运行程序时收到这些消息:

" RuntimeWarning: Degrees of freedom <= 0 for slice
  warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning)"
"RuntimeWarning: invalid value encountered in double_scalars"
"RuntimeWarning: invalid value encountered in greater return (self.a < x) & (x < self.b)"
"RuntimeWarning: invalid value encountered in less
  return (self.a < x) & (x < self.b)"
"RuntimeWarning: invalid value encountered in less_equal
  cond2 = cond0 & (x <= self.a)"

这是我代码的一部分:

        for j_of_ErrDiffRange in ErrDiffRange_cols:
           if np.isinf(j_of_ErrDiffRange):
               ind_err = ErrDiff > ErrDiffRange_cols[-2]
           else:
               ind_err = ErrDiff <=j_of_ErrDiffRange

           inError_bool=ind_err
           Ref_inRange_bool=ind_err & ind_ref
           CNOGA_inRange_bool=ind_err & ind_CNOGA

           Ref_for_avg=Ref[Ref_inRange_bool]
           Ref_for_totalrow=Ref[inError_bool]

           CNOGA_for_avg=CNOGA[CNOGA_inRange_bool]
           CNOGA_for_totalrow=CNOGA[inError_bool]
           t, p_value= stats.ttest_ind(Ref_for_avg, CNOGA_for_avg, 
           equal_var=False)
           t_tot, p_value_tot= stats.ttest_ind(Ref_for_totalrow, 
           CNOGA_for_totalrow, equal_var=False)
你可以帮我找到问题吗?

非常感谢。

0 个答案:

没有答案