Closed gabrielmoisan closed 6 years ago
Hi Gabriel,
Cohen's d can be calculated simply as the difference between means, divided by the standard deviation like this:
import numpy as np
Q = 101 #number of continuum nodes
JA = 8 #sample size, Group A
JB = 8 #sample size, Group B
yA = np.random.randn(JA, Q) #random sample, GroupA
yB = np.random.randn(JB, Q) #random sample, GroupB
mA = yA.mean(axis=0) #mean, Group A
mB = yB.mean(axis=0) #mean, Group B
sA = yA.std(axis=0, ddof=1) #st.dev., Group A
sB = yB.std(axis=0, ddof=1) #st.dev., Group B
s = np.sqrt( ( (JA-1)*sA**2 + (JB-1)*sB**2 ) / (JA+JB) ) #pooled st.dev.
d = ( mA - mB ) / s #Cohen's d
To export results from Python in text format see np.savetxt
The figure can be reproduced using matplotlib.pyplot.subplot and standard spm1d plotting commands
Todd
Todd, Thank you for your time. I really appreciate it! Gabriel
Hello Todd,
I think it would be useful to report Cohen's effect size by default in the output of the spm1d
inference functions.
Thank you for your suggestion. This could indeed be done, but I worry that it could be misleading. One-dimensional randomness amplifies values like Pearson's coefficient, ICC and Cohen's coefficients, so the typical interpretations of these values (e.g. r=0.9 represents relatively strong positive correlation) do not hold for 1D data.
Hi, Thank you for your previous answers. They were very helpful and the manuscript is almost ready for submission. But before, we would like to report Cohen's D of Hedges' g effect sizes. We performed one way ANOVA with SPM. Do you have any open-source codes for Python to: