Home Forums Main Forums Python Forum question about t-test function

  • question about t-test function

     Tundra.L updated 6 months, 2 weeks ago 2 Members · 5 Posts
  • Justin

    Administrator
    November 26, 2020 at 4:21 pm
    Up
    0
    Down

    Generally, you should remove the null values and use non-equal variances.

    • Tundra.L

      Member
      November 26, 2020 at 4:35 pm
      Up
      0
      Down

      thank you.

      non-equal variance means we should use:

      equal_var=False

      correct?

      • Justin

        Administrator
        November 28, 2020 at 9:03 pm
        Up
        0
        Down

        Yes, correct!

  • Tundra.L

    Member
    November 26, 2020 at 12:11 pm
    Up
    0
    Down

    When I did t-test, the parameters affect lot, the results are different. I am not sure which one is better:

    t,p_value=stats.ttest_ind(Loan[Loan['Bad']==0]['mtg_due'],
    Loan[Loan['Bad']==1]['mtg_due'],
    nan_policy='omit')
    print("ttest_ind: t = %g p_value = %g" % (t, p_value))
    #t = 4.45713 p_value = 8.40104e-06
    t,p_value=stats.ttest_ind(Loan[Loan['Bad']==0]['mtg_due'].isnull()==False,
    Loan[Loan['Bad']==1]['mtg_due'].isnull()==False)
    print("ttest_ind: t = %g p_value = %g" % (t, p_value))
    #t = 1.17903 p_value = 0.238412
    t,p_value=stats.ttest_ind(Loan[Loan['Bad']==0]['mtg_due'],
    Loan[Loan['Bad']==1]['mtg_due'],
    equal_var=False, nan_policy='omit')
    print("ttest_ind: t = %g p_value = %g" % (t, p_value))
    #t = 4.19483 p_value = 2.82717e-05

    the results are so different, it causes if the H0 is rejected or not.

Log in to reply.

Original Post
0 of 0 posts June 2018
Now