Comments (4)
Thank you Marco. Now it seems to work.
from effsize.
Concerning the estimate being outside the CI limits: a bug was found where the sign of the CI limits was flipped.
Concerning the correctness of the values, let us refer to an example available in the literature.
I consider the paper by David C. Howell available online.
The paper reports a case -- taken from Adams, Wright, and Lohr (1996) -- with two samples
Homophobic | Nonhomophobic |
---|---|
Mean | 24.00 |
Variance | 148.87 |
N | 35 |
With the t statistics: t=2.48, df =62 , d=0.62
The Cohen's d CI is then [0.117, 1.124].
We can generate the data as
set.seed(537)
hf = generate_data(35,24,sqrt(148.87))
nhf = generate_data(29,16.5,sqrt(139.16))
The fixed version of effsize
package can be called as
cohen.d(hf,nhf,noncentral=TRUE)
and it returns
Cohen's d
d estimate: 0.6239505 (medium)
95 percent confidence interval:
inf sup
0.117339 1.125768
Which is perfectly in line with the values reported in the paper (the paper used truncated values therefore a slight difference is observable for the upper limit)
Using the alternate version from psych
package we have
ttr = apa::t_test(hf,nhf)
psych::cohen.d.ci(apa::cohens_d(ttr),
n1 = ttr$parameter + 1,
alpha = .05)
that returns
lower effect upper
[1,] 0.3483285 0.6239505 0.895237
Which is clearly different from the expected result reported in the paper.
The function to generate a data set with given mean and stdev is:
generate_data <- function(n,m,stdev){
x <- rnorm(n,m,stdev)
sd.adj = stdev/sd(x)
x <- x * sd.adj
m.adj = m - mean(x)
x <- x + m.adj
return(x)
}
from effsize.
Hi Marco,
I installed now devtools::install_github("mtorchiano/effsize") and have now version 0.7.2.
However, the result is still the same as reported first.
Your example is not for paired data.
Thanks
Daniela
from effsize.
I take another example from the same paper.
The paper reports a single sample case with an expected mean = 1, I turned into the equivalente paired two sample with one sample being all 1
s:
moon.data = c(1.73, 1.06, 2.03, 1.40, 0.95, 1.13, 1.41, 1.73, 1.63, 1.56)
g1 = rep(1,length(moon.data))
The paper reports a 95% CI equal to 0.488 ≤ d ≤ 2.33
Using the psych::cohen.d.ci()
function:
ttr = t.test(moon.data,g1,paired=TRUE)
psych::cohen.d.ci(apa::cohens_d(ttr),
n1 = ttr$parameter + 1,
alpha = .05)
I get:
lower effect upper
[1,] 0.4655942 1.359018 2.216011
Using the effsize::cohen.d()
function:
effsize::cohen.d(moon.data,g1,
paired = TRUE,
noncentral = TRUE,
conf.level = 0.95)
I get
Cohen's d
d estimate: 1.359018 (large)
95 percent confidence interval:
lower upper
0.4907785 2.3358769
This latter result is clearly closer to the one in the paper, though the values in the paper have been computed using truncated results, this explains the slight difference.
from effsize.
Related Issues (20)
- cohen.d in effsize package
- Minor mistake in documentation for cohen.d
- The confidence interval does not contain the point estimation value. HOT 1
- pooled=T causes error
- cohen.d not recognizing numeric values HOT 1
- Error with pooled cohen HOT 1
- Typo in sample code
- Missing check on cliff delta input
- Error in the CI formula? HOT 3
- cohen.d.formula(..., paired=T) gives different results depending on data's sorting order HOT 2
- Effect size is wrong for paired data HOT 1
- cliff.delta missing values issue HOT 3
- New version of R HOT 1
- Problem with paired `cohen.d` HOT 1
- Order of labels change the outcome of VD.A HOT 1
- Improve reference for effect sizes Cliffs delta HOT 2
- Hedges's correction for one-sample Cohen's d use a different formula
- Wrong magnitude labels for `VD.A()`?
- cohen.d() is giving different CIs depending if paired is used or the equivalent 1-sample t-test. Also different to JASP and SPSS HOT 2
- cohen.d does not agree with other cohens_d measures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from effsize.