1

I have two dataframes of samples both are from different populations (df1 and df2)

I am trying to get the t and p-value. Here's what I have done:

In [1]: import scipy.stats as stats
        stats.ttest_ind(a=df1, b=df2)
Out [1]: Ttest_indResult(statistic=-2.071536903102, pvalue=0.0385310564401)

What this input produce are the t and p-value for the null hypothesis: null_hypothesis_1.

In contrast, what I am trying to do is to get the t and p-value for the null hypothesis that there is a particular means difference which is a particular number, for instance, 0.3, null_hypothesis_2

Is there any function in any library that can handle this?

petezurich
  • 9,280
  • 9
  • 43
  • 57
sempraEdic
  • 132
  • 9

1 Answers1

0

If you are testing the hypothesis that the two data frames are the same distribution except that the means are different by 0.3, just subtract 0.3 off of df1. Then you can use the standard stats.ttest_ind function you used previously.

alexpiers
  • 696
  • 5
  • 12