Skip to content
New issue

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

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

Already on GitHub? # to your account

function cohen.d: Hedge's g uses wrong DFs for one-sample case #155

Open
spressi opened this issue May 10, 2024 · 0 comments
Open

function cohen.d: Hedge's g uses wrong DFs for one-sample case #155

spressi opened this issue May 10, 2024 · 0 comments

Comments

@spressi
Copy link

spressi commented May 10, 2024

There is a small mistake in the function cohen.d:
According to Cumming (2011) p. 294, the degrees of freedom are N-1 for a one-sample design (i.e., if f=NA) and also for a within-subjects design (i.e., if paired=T). Only for the case with two independent samples, the degrees of freedom are N-2. The function, however, also calculates N-2 for the one-sample case (and possibly also for paired=T I have not checked this.

Minimal Reproducible Example:
library(tidyverse); iris %>% group_by(Species) %>% summarise( cohen_d = effsize::cohen.d(Sepal.Length, f=NA)$estimate, n = Sepal.Length %>% na.omit() %>% length(), #should not use n() because it doesn't handle NAs correctly hedges_g = effsize::cohen.d(Sepal.Length, NA, hedges.correction=T)$estimate, hedges_g_df1 = cohen_d * (1 - (3 / (4 * (n-1) - 1))), #for one-sample & within: df = N - 1 hedges_g_df2 = cohen_d * (1 - (3 / (4 * (n-2) - 1))), #for two independent samples check_df1 = hedges_g == hedges_g_df1, check_df2 = hedges_g == hedges_g_df2 )

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

No branches or pull requests

1 participant