Hello,
I want to run Welch’s test. But, I did not know how to apply the code below from [1]:
def welch_ttest(x, y):
## Welch-Satterthwaite Degrees of Freedom ##
dof = (x.var()/x.size + y.var()/y.size)**2 / ((x.var()/x.size)**2 / (x.size-1) + (y.var()/y.size)**2 / (y.size-1))
t, p = stats.ttest_ind(x, y, equal_var = False)
print("\n",
f"Welch's t-test= {t:.4f}", "\n",
f"p-value = {p:.4f}", "\n",
f"Welch-Satterthwaite Degrees of Freedom= {dof:.4f}")
welch_ttest(setosa['petal_length'], virginica['petal_length'])
What are the x’s and y’s?
[1] https://pythonfordatascienceorg.wordpress.com/welch-t-test-python-pandas/