<!--
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Distributions-Normal}
\usepackage{amsmath,amssymb}
-->

Normal Distribution
========================================================

Probability density function:
-------------------------
$$f(x) = \frac 1 {\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2} {2\sigma^2}}$$
with $\mu$ the mean of the distribution and $\sigma$ the standard deviation

<!--
```
Mathematica Code: 
1/(sigma*sqrt(2*pi))*e^(-(x-mu)^2/(2*sigma^2))
```
-->

Cumulative distribution function:
-------------------------
$$F(x) =\int_{-\infty}^{x}\frac 1 {\sigma\sqrt{2\pi}} e^{-\frac{(y-\mu)^2} {2\sigma^2}}dy
       =\int_{-\infty}^{\frac {x-\mu}{\sigma}}\frac 1 {\sqrt{2\pi}} e^{-\frac{z^2} {2}}dz
       =\frac 1 2 \left[1+\text{erf}\left(\frac {x-\mu} {\sigma\sqrt{2}} \right)\right]$$
with $\text{erf}$ being the error function.

<!--
```
Mathematica Code: 
Integrate[1/sqrt(2*pi)*e^(-z^2/2),{z,-Infinity,(x-mu)/sigma}]
```
-->

Log-likelihood function:
-------------------------
$$L(\mu,\sigma;X)=\sum_i\left[-\frac 1 2 \ln(2\pi)-\ln(\sigma)-\frac{1}{2\sigma^2}(X_i-\mu)^2\right]$$

<!--
```
Mathematica Code: 
log[1/(sigma sqrt(2 pi)) e^(-(x-mu)^2/(2 sigma^2))]-(x - mu)^2/(2 sigma^2) - Log[2 Pi]/2 - Log[sigma]
```
-->

Score function vector:
-------------------------
$$V(\mu,\sigma;X)
 =\left( \begin{array}{c}
        \frac{\partial L}{\partial \mu}  \\
        \frac{\partial L}{\partial \sigma}
        \end{array} \right)
 =\sum_i\left( \begin{array}{c}
              \frac {X_i-\mu}{\sigma^2} \\
              \frac {(X_i-\mu)^2-\sigma^2}{\sigma^3} 
              \end{array} \right)
$$

<!--
```
Mathematica Code: 
D[-(x - mu)^2/(2 sigma^2) - Log[2 Pi]/2 - Log[sigma],mu]
D[-(x - mu)^2/(2 sigma^2) - Log[2 Pi]/2 - Log[sigma],sigma]
```
-->

Observed information matrix:
-------------------------
 $$\mathcal J (\mu,\sigma;X)=
   -\left( \begin{array}{cc}
          \frac{\partial^2 L}{\partial \mu^2} & \frac{\partial^2 L}{\partial \mu \partial \sigma} \\
          \frac{\partial^2 L}{\partial \sigma \partial \mu} & \frac{\partial^2 L}{\partial \sigma^2} \end{array} \right)
 =\sum_i
 \left( \begin{array}{cc}
       \frac{1}{\sigma^2} & \frac{2(X_i-\mu)}{\sigma^3} \\
       \frac{2(X_i-\mu)}{\sigma^3} & \frac{3(X_i-\mu)^2-\sigma^2}{\sigma^4} \end{array} \right)
 $$

<!--
```
Mathematica Code: 
-D[D[-(x-mu)^2/(2 sigma^2)-Log[2 Pi]/2-Log[sigma],mu],mu]
-D[D[-(x-mu)^2/(2 sigma^2)-Log[2 Pi]/2-Log[sigma],mu],sigma]
-D[D[-(x-mu)^2/(2 sigma^2)-Log[2 Pi]/2-Log[sigma],sigma],sigma]
```
-->


