Suppose that I want to approximate an integral over finite range, say for example 0 to 10 using the Monte Carlo method.

Can I choose a normal distribution as the sampling distribution even though the interval of integral of a normal random variable is the whole real line instead of [0,10]?


$$ I = \int_{0}^{10} exp(-2|x-5|) dx $$

Let $f(X)$ be the pdf of $N(5,1)$.


$$I = \int_{0}^{10} \dfrac{exp(-2|x-5|)}{f(x)} f(x) dx $$

But $I \neq E_f\bigg[\dfrac{exp(-2|X-5|)}{f(X)}\bigg]$ and thus I cannot approximate $I$ with

$$\dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}$$

Appreciate any help. :)


1. Truncated normal distribution

Let $C = P(0< X <10)$. Then, the truncated $N(5,1)$ has pdf $g(x) = \dfrac{1}{C} f(x)$ for $x\in [0,10]$ and $g(x)=0$ otherwise.


$$I = \int_{0}^{10} \dfrac{exp(-2|x-5|)}{g(x)}g(x) dx = E_g\bigg[\dfrac{exp(-2|X-5|)}{g(X)}\bigg]$$

and hence,

$$\hat{I} = \dfrac{1}{n}\sum_{i=1}^{n} \dfrac{exp(-2|X_i-5|)}{g(X_i)}$$

2. Normal distribution

$$I = \int_{0}^{10} exp(-2|x-5|) dx = \int_{-\infty}^{\infty} exp(-2|x-5|)1_{\{0\leq x \leq 10\}} dx = \int_{-\infty}^{\infty} \dfrac{exp(-2|x-5|)1_{\{0\leq x\leq10\}}}{f(x)} f(x) dx = E_f\bigg[\dfrac{exp(-2|X-5|)1_{\{0\leq X \leq 10\}}}{f(X)}\bigg]$$


$$\hat{I} = \dfrac{1}{n}\sum_{i=1}^{n} \dfrac{exp(-2|X_i-5|)1_{\{0\leq X_i\leq 10\}}}{f(X_i)} \text{ , where } X_i \text{are iid rvs ~} N(5,1).$$


1 Answer 1


You can use the normal distribution as the sampling/importance/proposal distribution because it can generate values over the range you need. What would be bad is the reverse situation: if you used a distribution that was truncated to target the expectation of a non-truncated function.

You are correct that your last expression will not approximate your integral of interest. However, you are close. Instead, try the following: $$ \dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}1(0 \le X_i \le 10). $$ For samples that do not fall into the range $[0,10]$, the corresponding fraction summand will be equal to $0$. By the law of large numbers, this will converge to the integral you are interested in.

  • $\begingroup$ Can you show the expression of $I$? $\endgroup$
    – yh016
    May 10, 2018 at 5:18
  • $\begingroup$ @yh016 the sample average converges to the true average. That true average, or expectation, is taken with respect to $f$. And the indicator function is another way to write the bounds of the integral. $\endgroup$
    – Taylor
    May 10, 2018 at 14:14
  • $\begingroup$ @yh016 $\dfrac{1}{n} \sum_{i=1}^{n}\dfrac{exp(-2|X_i -5|)}{f(X_i)}1(0 \le X_i \le 10) \to E\left[ \dfrac{exp(-2|x -5|)}{f(x)}1(0 \le x \le 10)\right] = \int \dfrac{exp(-2|x -5|)}{f(x)}1(0 \le x \le 10) f(x) dx = \int exp(-2|x -5|)1(0 \le x \le 10) dx = I$. $\endgroup$
    – Taylor
    May 10, 2018 at 16:16
  • $\begingroup$ Thanks. Why is using a truncated distribution bad? $\endgroup$
    – yh016
    May 13, 2018 at 0:55
  • $\begingroup$ @yh016 it isn’t bad. that’s another option $\endgroup$
    – Taylor
    May 13, 2018 at 15:44

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.