Search code examples
scipygaussian

Why probability is more then 1 when SD is less then 1?


stats.norm(0, 0.1).pdf(0) -> 3.9894

enter image description here

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import math

mu = 0
variance = 1
sigma = math.sqrt(variance)
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma))

mu = 0
variance = (0.5*0.5) / np.sqrt(100)
sigma = math.sqrt(variance)
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
plt.plot(x, stats.norm.pdf(x, mu, sigma))

plt.show()

Solution

  • A probability density function's pointwise value is not a probability, so there is no reason to expect its value to be less than 1.

    Probabilities are expressed by appropriate integrals of PDFs. For example, a function that takes the value 10 between 0 and 1/10, and the value 0 everywhere else, is a valid PDF. Its value at 1/20 is 10>1, but its integral over any interval [a,b] is ≤1. It is this integral that expresses a probability, namely that the probability of the underlying random variable taking a value between a and b.