Effect Size in R-Cohen’s d

Effect Size in R, In the realm of statistics, researchers often seek to determine if there is a significant difference between the means of two groups.

While the p-value provides valuable insight into this matter, it doesn’t offer information about the magnitude of the difference.

This is where Cohen’s d comes into play. Cohen’s d is a measure of effect size that quantifies the difference between the means of two groups in terms of standard deviations.

In this article, we will delve into the calculation and interpretation of Cohen’s d, along with a practical example using R.

How to make a rounded corner bar plot in R? » Data Science Tutorials

Calculating and Interpreting Cohen’s d

Cohen’s d is calculated using the following formula:

Cohen’s d = (x1 – x2) / √(s12 + s22) / 2

where:
x1, x2 = mean of sample 1 and sample 2, respectively
s12, s22 = variance of sample 1 and sample 2, respectively

The interpretation of Cohen’s d is straightforward:

  • A d of 0.5 indicates that the two group means differ by 0.5 standard deviations.
  • A d of 1 indicates that the group means differ by 1 standard deviation.
  • A d of 2 indicates that the group means differ by 2 standard deviations.

Alternatively, we can interpret Cohen’s d as the value of the average person in group 1 being x standard deviations above the average person in group 2.

Rule of Thumb for Interpreting Effect Size in R

To help researchers interpret Cohen’s d, a rule of thumb is often used:

  • A value of 0.2 represents a small effect size.
  • A value of 0.5 represents a medium effect size.
  • A value of 0.8 represents a large effect size.

Example: Calculating Cohen’s d in R

Let’s consider an example where a botanist applies two different fertilizers to plants to determine if there is a significant difference in average plant growth (in inches) after one month.

The botanist measures the growth of 20 plants for each fertilizer. Using R and two different packages, we can calculate Cohen’s d:

Using the lsr Package

library(lsr)

define plant growth values for each group

group1 <- c(8, 9, 11, 11, 12, 14, 15, 16, 16, 18, 20, 21)
group2 <- c(7, 9, 10, 10, 11, 11, 12, 14, 14, 16, 20, 23)

#calculate Cohen's d
cohensD(group1, group2)

[1] 0.2635333

OLS Regression in R » Data Science Tutorials

Using the effsize Package

library(effsize) 

#define plant growth values for each group
group1 <- c(8, 9, 11, 11, 12, 14, 15, 16, 16, 18, 20, 21)
group2 <- c(7, 9, 10, 10, 11, 11, 12, 14, 14, 16, 20, 23)

#calculate Cohen's d
cohen.d(group1, group2)

Cohen's d

d estimate: 0.2635333 (small)
95 percent confidence interval:
lower upper
-0.5867889 1.1138555

In this example, both methods produce the same result: Cohen’s d is 0.2635.

We interpret this to mean that the average height of plants that received fertilizer #1 is 0.2635 standard deviations greater than the average height of plants that received fertilizer #2.

Using the rule of thumb mentioned earlier, we would interpret this to be a small effect size.

In other words, whether or not there is a statistically significant difference in the mean plant growth between the two fertilizers, the actual difference between the group means is trivial.

Conclusion

Cohen’s d is a valuable measure of effect size in statistics that complements the p-value.

It allows researchers to understand the magnitude of the difference between the means of two groups in terms of standard deviations.

By calculating and interpreting Cohen’s d, researchers can better assess the practical significance of their findings and guide future research or applications.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen − six =