cohensD
Computes Cohen's d effect size for the standardized mean difference between two groups.
Cohen's d measures how far apart two group means are in units of standard deviation. A value of 0 means identical means; values around 0.2, 0.5, and 0.8 are conventionally considered small, medium, and large effects respectively (Cohen, 1988). The sign indicates direction: positive when the mean of x exceeds the mean of y.
Example:
val group1 = doubleArrayOf(2.0, 4.0, 6.0, 8.0)
val group2 = doubleArrayOf(1.0, 2.0, 3.0, 4.0)
cohensD(group1, group2) // ~1.15 (large effect)
cohensD(group1, group2, pooled = false) // same when n1 = n2Return
the Cohen's d effect size.
Parameters
the first sample. Must contain at least 2 elements.
the second sample. Must contain at least 2 elements.
whether to use the pooled standard deviation, which weights each group's variance by its degrees of freedom. Defaults to true. When false, uses the unweighted root-mean-square of the two group standard deviations, which treats both groups equally regardless of sample size. The two variants give identical results when the sample sizes are equal.