0
$\begingroup$

I need to generate few random numbers, but they need to be distributed in a very specific (continuous) function $R(x)$. Once I do not have much background in the topic, I would like to ask 2 questions:

1. Can I create a p.d.f. by my self normalizing $R_{n}(x) = R(x)/ \int_0^\infty R(x)dx$?

2. Do you know a routine (mainly in Python) that does this MC task?

$\endgroup$
1
  • $\begingroup$ If you can upper bound $R(x)$ by a constant times the density of a distribution you can easily sample from, then you can use rejection sampling to generate your values, with no need to integrate. $\endgroup$
    – Henry
    Commented May 13, 2021 at 16:25

1 Answer 1

1
$\begingroup$

There are a few things you can do with a distribution:

  • a. write it down as an unsolved integral,

  • b. write it down as a solved integral,

  • c. evaluate its normalized version on a computer at different inputs,

  • d. sample from its distribution,

  • e. approximate expectations of its distribution, and

  • f. evaluate exactly expectations of its distribution.

These are all different things. To answer your questions.

  1. Yes if $R$ is nonnegative, $0$ on the negatives, and integrable (you didn't mention these assumptions). And yes if by "create" you mean write it down on paper. Sometimes the normalizing constant integral is difficult or impossible to compute. Indeed, this is one of the main selling points for MCMC and other sampling-based strategies--they accomplish task (e) without requiring task (c).

  2. Monte Carlo is aimed at task (e) not task (b). It requires you to be able to do task (d)...but, the first sentence suggests that you are interested in task (d).

$\endgroup$
2
  • $\begingroup$ Yes $R$ is nonnegative and integrable and the idea is to use von-Neumann's acceptance-rejection technique to sample from the distribution as you said. $\endgroup$
    – guinomo
    Commented May 13, 2021 at 19:17
  • $\begingroup$ @marcos that’s a great way to do (d) requiring only (a). However, the upper bound is occasionally difficult to do well. Plenty of great questions on that on this site. Good luck and have fun $\endgroup$
    – Taylor
    Commented May 14, 2021 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.