0

Hopefully someone can help me as the question drives me completely crazy. I'm using R to calculate Cohen's d with the following code and every time I get different results.

What am doing wrong?

library(effsize)
treatment = rnorm(75,mean= 15.37, sd= 8.43) 
control = rnorm(75,mean=21.20, sd=8.37) 
cohen.d(treatment,control,na.rm=FALSE,pooled=TRUE,paired=FALSE)
Stefan
  • 6,431

1 Answers1

4

The rnorm code generates a random normal variable, which changes each time you run your code.

To make the code reproducible, use set.seed(), for example set.seed(1).

  • Thank you! Iam using mes() now as Im interested in constant d values and not in a simulation. For what could it be good? – user195214 Feb 13 '18 at 15:38