Git Product home page Git Product logo

Comments (4)

dfeistauer avatar dfeistauer commented on September 1, 2024 1

Thank you Marco. Now it seems to work.

from effsize.

mtorchiano avatar mtorchiano commented on September 1, 2024

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.

dfeistauer avatar dfeistauer commented on September 1, 2024

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.

mtorchiano avatar mtorchiano commented on September 1, 2024

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 1s:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.