|
I've implemented a few Probability Density Functions and sampling methods for an MCMC algorithm, but I'm not really sure how to check if they're consistent or not. For example, if I have a discrete sampling method and probability mass function, I can generate a bunch of samples and check how the empirical distribution compares to the function's prediction. Is there something similar I can do for continuous random variables? |
|
Complementing Kevin's answer, if you prefer to compute the cdf (cumulative density function), which is the integral of the pdf, you can take many samples, sort them by numerical value, plot numerical value versus ranked position (normalized to be between 0 and 1), and see if the step function approaches the shape of the cdf. |
|
Generate some samples, group them into bins, and check that the empirical bin frequencies match the integral of the pdf over each bin. Calculate the integrals numerically using point samples of the pdf given by your function. |