Home > AI > Uncategorized

Univariate gaussian distribution

The probability density function (PDF) for the Gaussian Distribution is as follows:

(1)   \begin{equation*}\begin{matrix}p(x) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2}(\frac{x-\mu}{\sigma})^2} \\X \in R^n, \mu \in R, \sigma \in R\end{matrix}\end{equation*}

Where \mu is the mean or expection of the distribution (same as median and model). \sigma is the standard deviation and \sigma^2 is the variance.

mu, sigma = 0, 0.1 # mean and standard deviation
x = np.random.normal(mu, sigma, 1000)

count, bins, ignored = plt.hist(x, 30, density=True)
y = 1/(sigma * np.sqrt(2 * np.pi)) * np.exp( - (bins - mu)**2 / (2 * sigma**2) )
plt.plot(bins, y, linewidth=2, color='r')
plt.xlabel('X')
plt.ylabel('Probility')
plt.title('Normal distribution')
plt.show()

It is often written as

(2)   \begin{equation*}X \sim \mathcal{N}(\mu, \sigma^2)\end{equation*}


Calculate mean, expectation, median, mode.

Calculate standard deviation, variance, covariance.

Related posts:

Leave a Reply