If I have an analytical pdf of a generated random variable like this
y= (x**(d-1)*e**(-x/g))/(math.gamma(d)*g**d)
where d and g are constants
How to generate this pdf using the Monte-Carlo simulation
I substitute with x in the analytical equation and the PDF is generated, however for simulation I don’t know how to do
This is Gamma distribution.
Shape would be d and scale would be g.
Sampling
import numpy as np
shape=d
scale=g
s = np.random.gamma(shape, scale, 1000) # draw 1000 RVs from gamma distribution