statistics t test sample size in the formula for t test, t = (mean1 - mean2)/sqrt[(var1 + var2)/N]


*

*is N the total number of subjects in both groups being compared or the number of subjects in each group or condition?

*df = N-2 
is N the total number of subjects in both groups being compared or the number of subjects in each group or condition?
 A: There are two fairly common forms for the independent-samples two-sample t-test:

*

*The assumed-equal-variance form:
$$t = \frac{\bar {X}_1 - \bar{X}_2}{s_p \cdot \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}\,,\quad$$
where $s_p = \sqrt{\frac{(n_1-1)s_{1}^2+(n_2-1)s_{2}^2}{n_1+n_2-2}}\,$, with df $\nu=n_1+n_2-2$.


*The Welch (unequal variance) approximation:
$$t = {\overline{X}_1 - \overline{X}_2 \over s_d}\,,$$
where $s_d = \sqrt{{s_1^2 \over n_1} + {s_2^2  \over n_2}}$, with approximate df $\nu= \frac{(s_1^2/n_1 + s_2^2/n_2)^2}{(s_1^2/n_1)^2/(n_1-1) + (s_2^2/n_2)^2/(n_2-1)}.$.

The equation you have is for equal-n, equal-variance and is a simplified version of the first form.
The $N$ in your first formula is the sample size in each group, $n=n_1=n_2$. Your df is then $2n-2$.
The $N$ in your second equation is inconsistent with the $N$ in your first equation - they seem to be being used for different things. Specifically, in the second equation, it seems to represent the total sample size, $n_1+n_2$.
