Closed Daiki-Nakamura-git closed 10 months ago
Weird, the code is internally in place, but wasn't available to the user. Is now on #626
# Data
ne <- 100 ; nc <- 100 # sample size
set.seed(123)
E <- rnorm(ne, 2, 2) # Experiment Group
C <- rnorm(nc, 1, 1) # Control Group
# Biased Estimator
(dg <- (mean(E) - mean(C)) / sd(C))
#> [1] 1.332344
library(effectsize)
effectsize::glass_delta(E, C) |> print(digits = 6)
#> Glass' delta | 95% CI
#> -----------------------------------
#> 1.332344 | [0.871576, 1.787429]
# Unbiased Estimator
df <- nc - 1 # degree of freedom
J <- gamma(df / 2) / (sqrt(df / 2) * gamma((df - 1) / 2)) # correction factor
(dg.adj <- dg * J)
#> [1] 1.32222
effectsize::glass_delta(E, C, adjust = TRUE) |> print(digits = 6)
#> Glass' delta (adj.) | 95% CI
#> ------------------------------------------
#> 1.322220 | [0.864954, 1.773848]
Created on 2024-01-19 with reprex v2.0.2
Thank you for the rapid correction.
Hello, thank you for your continued development of the
effectsize
package. I would like to request that an unbiased estimator of Glass' delta be added to theeffectsize
package.The estimator obtained by
glass_delta()
is not an unbiased estimator. The unbiased estimator is corrected by the correction factor J proposed by Hedges (1981).Parameter $$\delta_g=\frac{\mu_E-\mu_C}{\sigma_C}$$ E: Experiment Group C: Control Group
Biased Estimator $$d_g=\frac{\bar{E}-\bar{C}}{\hat{\sigma_C}}$$
Unbiased Estimator $$\hat{\delta_g}=d_g*J$$ $$J=\frac{\Gamma{(df/2)}}{\sqrt{df/2}\cdot\Gamma{\frac{(df-1)}{2}}}$$ $$df=n_C-1$$
In R code, this can be expressed as follows.
Is there a function implemented to obtain such an unbiased estimator? If not, I would like to see it added.