# [Tex/LaTex] Standard Deviation

math-mode

I have my code for standard deviation formula as follow:

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}

\begin{document}
$t=\dfrac{\overline{X}_{1}-\overline{X}_{2}} {\sqrt{\dfrac{\left\lbrace\Sigma X_{1}^{2} \dfrac{\left( \Sigma X_{1}\right)^{2}}{N_{1}}\right\rbrace+\left\lbrace\Sigma X_{2}^{2} \dfrac{\left(\Sigma X_{2}\right)^{2}}{N_{2}}\right\rbrace} {N_{1}+N_{2}-2}\text{x}\left( \dfrac{N_{1}+N_{2}}{N_{1}N_{2}} \right)}}$
\end{document}


It looks complicated. Is there any simple way to make the same formula?

I must confess I'm not sure if your formula is correct. For sure, the formula does not denote a standard deviation, as would appear to be implied by your query. Instead, it appears to be an expression for the t-test of the null hypothesis that two population means are equal, assuming the draws are iid (independently and identically distributed).

The following screenshot reproduces your original formula in the first row, a typographically simplified version of that formula, in which I've replaced all instances of \Sigma with \sum, in the second row, and what I believe to be the standard form of the t-test in the third row. For what it's worth, it's the formula I learned in an econometrics course while in grad school, many years ago. And, I daresay, the formula in the third row is easier to read and parse than those in rows 1 and 2...

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}  % for 'align*' env.

\begin{document}
\noindent
We wish to test the null hypothesis that the means of two populations are equal.
Denote the observations drawn from the two populations by $X_{1i}$ and~$X_{2j}$,
with $i=1,\dots,N_1$ and $j=1,\dots,N_2$. Let
$\bar{X}_1=\frac{1}{N_1}\sum_{i=1}^{N_1} X_{1i} \quad\text{and}\quad \bar{X}_2=\frac{1}{N_2}\sum_{j=1}^{N_2} X_{2j}$
denote the sample means, and let
$\hat{\sigma}_1^2=\frac{1}{N_1-1}\sum_{i=1}^{N_1} (X_{1i} -\bar{X}_1)^2 \quad\text{and}\quad \hat{\sigma}_2^2=\frac{1}{N_2-1}\sum_{j=1}^{N_2} (X_{2j} -\bar{X}_2)^2$
denote the sample variances. If the observations are iid,
the $t$-test of the null hypothesis is given by
\begin{align*}
t&=\dfrac{\overline{X}_{1}-\overline{X}_{2}}
{\sqrt{\dfrac{
\left\lbrace\Sigma X_{1}^{2}
\dfrac{\left( \Sigma X_{1}\right)^{2}}{N_{1}}\right\rbrace
+\left\lbrace\Sigma X_{2}^{2}
\dfrac{\left(\Sigma X_{2}\right)^{2}}{N_{2}}\right\rbrace}
{N_{1}+N_{2}-2}\text{x}
\left( \dfrac{N_{1}+N_{2}}{N_{1}N_{2}} \right)}} \\
&=\frac{\bar{X}_1-\bar{X}_2}{\displaystyle
\Biggl[\frac{
\sum X_1^2 \frac{ (\sum X_1)^2}{N_1}+\sum X_2^2
\frac{ (\sum X_2)^2}{N_2}}{N_1+N_2-2}
\times \frac{N_1+N_2}{N_1N_2}
\Biggr]^{1/2}} \\
&=\frac{\bar{X}_1-\bar{X}_2}{\displaystyle
\biggl[
\frac{(N_1-1)\hat{\sigma}_1^2 + (N_2-1)\hat{\sigma}_2^2}{N_1+N_2-2}
\biggl(\frac{1}{N_1}+\frac{1}{N_2}\biggr)
\biggr]^{1/2}}
\end{align*}
\end{document}