# calculate sample size, differences between software

Currently I'm doing a power calculation using the pwr package. I thought it should be very simple, but I'm not sure if I'm doing it right. I use R to calculate the sample size. I checked my results using other software. The results are really different. The documentation of the other software isn't available, that's why I post this question.

In short. I'm going to perform a two-sample, two-sided t-test. The no. of observations between the two groups are the same. I would like to measure/calculate a difference between the means of 4. The variance of my test is 12. The variance is equal between the groups. sig. level = 0.05 and the power is 0.8.

Using the pwr package I get the following code

d <- 4/12
pwr.t.test(n=NULL, d=d, sig.level=0.05, power=0.8, type="two.sample", alternative="two.sided")


With the following results

Two-sample t test power calculation

          n = 142.2462
d = 0.3333333
sig.level = 0.05
power = 0.8
alternative = two.sided


NOTE: n is number in each group

However, the other software I use says that I just need 13 replications. Is the other package using another theory about calculating the no. of replications for a t-test? Or am I doing something wrong?

I hope you can help me out.

Best regards, Robin

This is from Minitab:

Power and Sample Size

2-Sample t Test

Testing mean 1 = mean 2 (versus ≠)
Calculating power for mean 1 = mean 2 + difference
α = 0.05  Assumed standard deviation = 3.464

Sample  Target
Difference    Size   Power  Actual Power
4      13     0.8      0.806340

The sample size is for each group.


I think you may be confusing the population variance (not 'test' variance) $$\sigma^2 = 12$$ with the population standard deviation $$\sigma = 3.464.$$ If I enter $$\sigma = 12,$$ I get $$n = 143.$$

I believe the parameter $$d$$ in your output is intended to be $$d=\Delta/\sigma,$$ which should be $$d = 4/3.464,$$ but by using $$\sigma = 12,$$ you make it $$d = 4/12 = 1/3 = 0.333.$$

• you're right. This is what I didn't understand. Thank you for this clarification – Soml Dec 28 '18 at 9:57