Just as we can write the CDF and PDF of a random variable X, following a normal distribution, with its parameters - std and mean using scipy in the following manner:
from numpy import sqrt, pi, exp
mean, std = 295, 250
# defining Cumulative density function
def cdf(x):
cdf_eqn = lambda t: (1 / (std * sqrt(2 * pi))) * exp(-(((t - mean) ** 2) / (2 * std ** 2)))
cdf = quad(cdf_eqn, -np.inf, x)[0]
return cdf
# defining Probability distribution function
def pdf(x):
return (1 / (std * sqrt(2 * pi))) * exp(-(((x - mean) ** 2) / (2 * std ** 2)))
How can I define the CDF and PDF of a gamma distribution in the same way above?