Efficient code for obtaining the probability of X or less, when the PDF is known, but the CDF cannot be expressed precisely

2 views (last 30 days)
I am working on a problem relating to a PDF that I can express precisely, and the related CDF, which I have given up expressing precisely. The PDF changes depending on the value of multiple constants, and I intend to write a simulation where these constants will most definately change each period. Effectively, my PDF will change every period.
Given that I need to work out the probability of a particular magnitude (or less) occuring each period, I am facing the problem of how to efficiently obtain that value in this situation, where the CDF must be constructed from the known (but always changing) PDF.
I would appreciate help on this problem, perhaps with code where it is assumed the PDF of the normal distribution is available, but the CDF is not. I would have no problem transferring a solution to my particular problem. I am most interested in being shown a fast, efficient solution.

Answers (1)

Jeff Miller
Jeff Miller on 7 Dec 2019
Unless you have closed form or a good approximation to the CDF, it seems like your only option is to integrate the PDF with MATLAB's integral function, which may or may not be fast enough for your simulation purposes.
Depending on how many iterations you want to do and how many different parameter values you want to allow for, it might be faster to compute a set of integral tables in advance (one table for each parameter combination) and then use a table-lookup scheme, perhaps interpolating, to get the CDF values during the simulation.

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!