Standard Normal distribution#

The standard Normal distribution is a parameter-free, symmetric, continuous probability distribution and a special case of the Normal distribution: it has a mean of zero and a standard deviation of one.

In the following, let \(U\) be a random variable that follows a standard Normal distribution, and let \(u\) denote a particular outcome of \(U\). The letter \(U\) is often used to represent a standard Normal random variable.

import fesslix as flx
flx.load_engine()

import numpy as np
import fesslix.plot as flx_plot
import matplotlib.pyplot as plt
%matplotlib inline
Random Number Generator: MT19937 - initialized with rand()=1105953948;
Random Number Generator: MT19937 - initialized with 1000 initial calls.

Syntax#

property stdn#

Standard Normal distribution

stdn is a distribution type (flx_rv_type) for Random variables in Fesslix.

Example:

rv = flx.rv({'type':'stdn'})

Properties#

Notation

\(U\sim \mathcal{N}(0,1)\)

Support

\(u\in\mathbb{R}\)

Mean

\(\mu_U = 0\)

Standard deviation

\(\sigma_U = 1\)

Median

zero

Mode

zero

Skewness

zero

Excess kurtosis

zero

Entropy

\(\frac{1}{2}\ln\left(2\pi e\right)\)

PDF#

The PDF of the standard Normal distribution is commonly denoted by the Greek letter \(\varphi\):

\[\varphi_U(u) = \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2} u^2}\]

The density has its maximum at \(\varphi_U(0) \approx 0.4\); its inflection points are \(\varphi_U(\pm 1) \approx 0.24\).

fig, ax = plt.subplots(figsize=(10, 4))
flx_plot.draw_pdf(ax, rv) 
ax.set_ylim([0., None])
plt.xlabel(r"$u$")
plt.ylabel(r"$\varphi_U(u)$")
plt.show()
../_images/b9f4eb9977a236654429a069c2241cf11cfbb4784c2ff29258b48b22ba71c7f7.png

CDF#

The CDF of the standard Normal distribution is commonly denoted by the Greek letter \(\Phi\):

\[\Phi_U(u) = \int_{-\infty}^u \varphi_U(t)\,\mathrm{d}t = \frac{1}{2}\left[1+\mathrm{erf}\left(\frac{u}{\sqrt{2}}\right)\right]\]

Here \(\mathrm{erf}(\cdot)\) denotes the error function.

The standard Normal distribution has the following property:

  • \(\Phi_U(-u)=1-\Phi_U(u)\)

fig, ax = plt.subplots(figsize=(10, 4))
flx_plot.draw_cdf(ax, rv) 
ax.set_ylim([0., 1.])
plt.xlabel(r"$u$")
plt.ylabel(r"$\Phi_U(u)$")
plt.show()
../_images/15d549ac9f0cdd8d6c10d520f461b79128b1c8245e6dac809d11afcbafbc8417.png

Quantile function#

The quantile function of the standard Normal distribution is expressed in terms of the inverse error function \(\mathrm{erf}^{-1}(\cdot)\):

\[\Phi_U^{-1}(p) = \sqrt{2} \cdot \mathrm{erf}^{-1}\left(2p-1\right)\;, \quad p\in(0,1)\]

Examples#

Generate realizations of a standard Normal random variable#

## generate one realization at a time
for i in range(10):
    print(f"{i:3.0f}  {rv.sample():5.2f}")

## generate a vector of realizations
smpl_vec = np.empty(10)
rv.sample_array(smpl_vec)
print(smpl_vec)
  0  -1.16
  1  -0.41
  2   0.89
  3   0.21
  4   0.81
  5   0.26
  6  -0.74
  7  -0.93
  8  -0.93
  9  -0.93
[ 0.78159121 -0.61052417 -0.29065605  0.972958    1.22178466  0.10829382
 -3.29818897 -1.5992497   0.37369618  0.59520119]