# Sample size for a paired t-test

#### NN_STAT

##### New Member
Hello all

I have a simple question. I need to calculate a sample size for a study that will be analyzed with a paired t-test.

One of the input parameters for the calculation, is the standard deviation of the differences. However, I do not know it. What I do know, is the standard deviation of the first group and the standard deviation of the second group.

Each subject will receive two treatments. A continuous measure will be taken after each. I know what is the standard deviation of the measure after the 1st treatment and I know what is the standard deviation of the measure after the 2nd treatment, but the standard deviation of D, I don't know.

SAS proc power allows to enter the standard deviations I do know, but I have no idea how from there they estimate the difference standard deviation. PASS on the other hand (which is a remarkable sample size software) asks directly for the difference standard deviation, which I don't know.

My question is, how do I estimate the difference standard deviation ? Via simulation ?

#### NN_STAT

##### New Member
this is probably somehow correct, however I have one slight problem. In order to calculate a pooled variance I need N, which is my unknown parameter in the first place.

#### trinker

##### ggplot2orBust
Could you use a different program? N is calculated based on test, effect size, alpha (usually .05) and power (usually .8). Basically if you know the effect size here you're in good shape. The program I often use is G-power. It's free and easy to use and works great for simpler models. http://www.psycho.uni-duesseldorf.de/abteilungen/aap/gpower3/

#### NN_STAT

##### New Member
I found it:

$$\sigma _{diff}=\sqrt{\sigma _{1}^{2}+\sigma _{2}^{2}-2\cdot \rho \cdot \sigma _{1}\cdot \sigma _{2}}$$

(sorry about LateX, don't know what's wrong)

I saw it in SAS details manual, however, I still don't know where this formula came from (anyone recognize it ?)

I tried the formula and I have some answers. PASS calculates using a 0 correlation, I tried calculating the standard deviation of differences using the formula with correlation 0, ran it in Gpower you recommended, and got a match.

Then I used correlation 0.3 and 0.5, but in Gpower and SAS, and got a match.

What I am saying is, that all software are working fine, I only wish I knew this formula, could have saved me a long long time.

The nice part, I tried simulating data with means and standard deviations like mine, and got same result like the formula gave...

Last edited by a moderator:

#### Dason

$$Var(X - Y) = Var(X) + Var(Y) -2Cov(X, Y)$$