Univariate Gaussian Distributions

Sources:

  1. The Normal/Gaussian Random Variable

Notations

In this article we'll use following notations interchangeably.

  • The PDF1 fX(x) is often denoted as pX(x), fX(x;μ,σ2) or pX(x;μ,σ2). We sometimes also omit the subscript X so that we can write things like f(x:μ,σ2).

  • A normal distribution is also called a Gaussian distribution.

  • Since a normal distribution is fully determined by its mean μ and variance σ2 (or standard deviation σ), we often denote a normal distribution as N(μ,σ2). A random variable, say X, having this distribution is denoted as XN(μ,σ2).

  • The notation XN(μ,σ2) can also be written as XN(x:μx,σx2).

  • We usually call a random variable X having the normal distribution as:

    1. normal (or Gaussian) X
    2. normal (or Gaussian) variable X
    3. normal (or Gaussian) random variable X
  • For a random variable having standard normal distribution, we often use the notation Z, i.e., ZN(0,I). Meanwhile, Z is also called:

    1. standard normal (or Gaussian) Z
    2. standard normal (or Gaussian) variable Z
    3. standard normal (or Gaussian) random variable Z
  • We use exp() to represent the where exp denotes the exponential function e().

Definition

In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable.

We use XN(μ,σ2) to denote that a real-valued random variable X follows the Gaussian distribution with mean=μ and standard deviation=σ.

The PDF for X is:

fX(x)=1σ2πexp(12(xμσ)2)

By definition,

  1. μ is the mean or expectation of the distribution E[X]=μ,

  2. σ2 is the variance of the distribution Var(X)=σ2.

You can think of the coefficient in front, 12πσ, as simply a constant "normalization factor" used to ensure that 12πσexp(12σ2(xμ)2)=1.

Notice the x in the exponent of the PDF function. When x is equal to the mean (μ) then e is raised to the power of 0 and the PDF is maximized.

Explanation

Figure 1

σ describes the spread of the data points around the mean.

μ defines the central location of the Gaussian distribution.

Code

1
2
3
4
5
import torch
def calculate_univariate_gaussian_distribution(x, mu, sigma):
leading_coefficient = 1 / (sigma * torch.sqrt(torch.tensor(2 * torch.pi)))
parameter_of_exp_function = -0.5 * (x - mu / sigma) ** 2
return leading_coefficient * torch.exp(parameter_of_exp_function)

Standard Normal

Figure 2

A normal distribution N(μ,σ2) is standard if μ=0 and σ2=1.

The random variable that follows a normal distribution is often denoted as ZN(0,1). Z is called the stanard normal.

Closure properties of the normal distribution

Recall that in general, if X is any random variable (discrete or continuous) with E[X]=μ and Var(X)=σ2, and a,bR. Then, E[aX+b]=aE[X]+b=aμ+bVar(aX+b)=a2Var(X)=a2σ2

Closure of the Normal Under Scale and Shift

If XN(μ,σ2), then aX+bN(aμ+b,a2σ2). In particular, XμσN(0,1)

We will prove this theorem later using Moment Generating Functions! This is really amazing the mean and variance are no surprise. The fact that scaling and shifting a Normal random variable results in another Normal random variable is very interesting!

Let X,Y be ANY independent random variables (discrete or continuous) with E[X]=μX,E[Y]=μY, Var(X)=σX2,Var(Y)=σY2 and a,b,cR. Recall, E[aX+bY+c]=aE[X]+bE[Y]+c=aμX+bμY+cVar(aX+bY+c)=a2Var(X)+b2Var(Y)=a2σX2+b2σY2

Closure of the Normal Under Addition

If XN(μX,σX2) and YN(μY,σY2) (both independent normal random variables), then aX+bY+cN(aμX+bμY+c,a2σX2+b2σY2)

Again, this is really amazing. The mean and variance aren't a surprise again, but the fact that adding two independent Normals results in another Normal distribution is not trivial, and we will prove this later as well!


  1. Probability density function↩︎