Interview Question: Practical Issue

Sample Question #172 (applied statistics)

In Monte Carlo simulations, we need to generate a random sample from some distribution. If I give you an arbitrary pdf f(x), how do you generate such a sample? Describe your methodology in detail using any software package or programming language you’re comfortable with.

This entry was posted in Sample Qs. Bookmark the permalink.

One Response to Interview Question: Practical Issue

  1. Brett says:

    There are two general methods for generating iid random variables given a distribution. (Specific short-cut methods exist for some popular distributions.) The more direct method involves finding the inverse transform of the cdf F(x). The idea is that the cdf of any distribution is a Uniform(0,1) distribution. If we can find its inverse function, we can first generate a random number from U(0,1) and use the inverse function to find the corresponding x from the original distribution. If the inverse of a cdf cannot be found easily (either algebraically or numerically), we use the sampler density technique (also known as the accept-reject technique), whereby we find a "simpler" cdf that’s similar to the original cdf and then correcting the generated data by some transform.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s