How to run Welch's test

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)
          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?

X and Y are your two separated datasets. For example, X might be traces from a constant plaintext/constant key capture set and Y might be traces from a random plaintext/constant key. Rambus has a pretty good document on TVLA (which I’m assuming is why you’re asking about t-tests):


1 Like

Thank you very much!
That was very helpful