Whitebeard
Whitebeard

Reputation: 6193

Effect Size Calculation

I am trying to calculate the effect size for a power analysis in R. Each data point is an independent sample mean.

data <- c(621.4, 621.4, 646.8, 616.4, 601.0, 600.2, 616.1, 613.4, 616.5, 624.3, 608.3, 624.2)
data.sd <- sd(data)

# effect size for a difference of means of 3
d <- 3 / data.sd

# sample size required
require(pwr)
pwr.t.test(d = d, power = 0.80, sig.level = 0.05, type = "two.sample", alternative = "two.sided")

Am I calculating the effect size correctly? Or should I divide the mean difference of 3 by the standard error?

d <- 3 / (data.sd / sqrt(length(data)))

Upvotes: 0

Views: 3080

Answers (1)

Thomas
Thomas

Reputation: 44527

Power analysis can also be performed (at least for t-tests) in the preinstalled stats package:

> power.t.test(delta=3, sd=sd(data), sig.level=.05, power=.8)

     Two-sample t test power calculation 

              n = 263.7348
          delta = 3
             sd = 12.27414
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group

The documentation is pretty clear:

n           Number of observations (per group)
delta       True difference in means
sd          Standard deviation
sig.level   Significance level (Type I error probability)
power       Power of test (1 minus Type II error probability)

It's just the mean-difference and standard deviation; not Cohen's d or the SE.

Upvotes: 1

Related Questions