mtorchiano / effsize

Effsize - a package for efficient effect size computation
GNU General Public License v2.0
104 stars 11 forks source link

feature request: Cohen's d and Hedge's g for one-sample t-test #33

Closed IndrajeetPatil closed 4 years ago

IndrajeetPatil commented 5 years ago

As far as I can tell, this is currently not supported.

The syntax can look something like this, for example-

treatment = rnorm(100,mean = 10)
control = rnorm(100,mean = 12)
cohen.d(~d, mu = 0)
mtorchiano commented 5 years ago

Working on it.

This is how it could work (using default mu=0)

> treatment = rnorm(100,mean = 10)
> control = rnorm(100,mean = 12)
> cohen.d(~treatment, mu = 10)

Cohen's d (single sample)

d estimate: 0.0396593 (negligible)
Reference mu: 10
95 percent confidence interval:
     lower      upper 
-0.3572231  0.4365417 
> cohen.d(~control)

Cohen's d (single sample)

d estimate: 11.55047 (large)
Reference mu: 0
95 percent confidence interval:
    lower     upper 
 9.881998 13.218946 
IndrajeetPatil commented 5 years ago

This looks good in terms of the function syntax but the effect size values here are pretty different from what I am getting with our custom function or with other widely-used software like JASP.

For example, here is JASP output for these two tests:

For treatment variable,

image

For control variable,

image

mtorchiano commented 4 years ago

Sorry for looking back into it only now.

The new feature will be delivered soon.

The syntax is slightly different: cohen.d(control~., mu = 10)

Concerning the values, I'm not sure to what case you are referring to, if it is for the examples in the screenshots, you set two different reference mu, that's why you get so wildly different values.