Are degrees of freedom $n-1$ for both the sample standard deviation of the individual observations and for the standard error of the sample mean?

I collect $n$ ($<20$) i.i.d. observations from any distribution. In order to compute the sample variance, I take $$s^2=\sum_i \frac{(\bar{X}-X_i)^2}{n-1}$$

If I want to build a confidence interval for the mean, I need the standard error of the sample mean. Do I divide by $n$, or by $n-1$ again?

$$S.E. \stackrel{?}{=}\sqrt{\frac{s^2}{n-1}}$$

• The first part of @Macro's answer here does the necessary derivation, and I think it's covered by the answers here. – Glen_b -Reinstate Monica Jun 5 '13 at 8:28

The sample mean is given by:

$$\bar{x}=\frac{\sum x_i}{n}$$

Thus, the standard error of the sample mean is:

$$SE = \sqrt{V(\bar{x})}$$

But:

$$V(\bar{x})=V(\frac{\sum x_i}{n})=\frac{\sum V(x_i)}{n^2}=\frac{nS^2}{n^2}=\frac{S^2}{n}$$

Therefore, you divide by $n$ and not by $n-1$.