Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbiased estimator of Glass' delta #625

Closed
Daiki-Nakamura-git opened this issue Jan 19, 2024 · 2 comments · Fixed by #626
Closed

Unbiased estimator of Glass' delta #625

Daiki-Nakamura-git opened this issue Jan 19, 2024 · 2 comments · Fixed by #626

Comments

@Daiki-Nakamura-git
Copy link

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 the effectsize 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.

# 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))
library(effectsize)
effectsize::glass_delta(E, C) |> print(digits = 6) 

# 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)

Is there a function implemented to obtain such an unbiased estimator?
If not, I would like to see it added.

@mattansb
Copy link
Member

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

@Daiki-Nakamura-git
Copy link
Author

Thank you for the rapid correction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants