Estimate Cohen's d for effect size

前端 未结 3 919
北恋
北恋 2021-02-01 08:24

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

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 08:48

    There are several packages providing a function for computing Cohen's d. You can for example use the cohensD function form the lsr package :

    library(lsr)
    set.seed(45)
    x <- rnorm(10, 10, 1)
    y <- rnorm(10, 5, 5)
    cohensD(x,y)
    # [1] 0.5199662
    

提交回复
热议问题