given two vectors:
x <- rnorm(10, 10, 1)
y <- rnorm(10, 5, 5)
How to calculate Cohen's d for effect size?
For example, I want to use the pwr package to estimate the power of a t-test with unequal variances and it requires Cohen's d.
given two vectors:
x <- rnorm(10, 10, 1)
y <- rnorm(10, 5, 5)
How to calculate Cohen's d for effect size?
For example, I want to use the pwr package to estimate the power of a t-test with unequal variances and it requires Cohen's d.
Another option is to use the effsize package.
There are several packages providing a function for computing Cohen's d. You can for example use the
cohensD
function form thelsr
package :Following this link and wikipedia, Cohen's d for a t-test seems to be:
Where
sigma
(denominator) is:So, with your data: