# Integration by sampling from truncated distribution

I'm reading the book Ben Lambert's Bayesian Statistics: problems and answers, which by the way I like.

There is a group of problems in "Integration by Sampling" chapter 12.

The first integral is

$$\int^{+\infty}_{-\infty} x^6 \cdot \frac{\exp (-\frac{x^2}{2})} {\sqrt{2 \pi}} \,dx$$

It is recommended to notice that this statement is equal to $$\mathbb{E}(x^6)$$ and to sample from $$x \sim N(0, 1)$$. Then it is straightforward to get sample mean $$\frac {1} {n} \sum^{n}_{i=1} x_i^6$$. Its value is around 15.

So far so good.

It is the next similar problem where I stuck. The difference is that now integral is from the same but truncated distribution (see integration limits).

$$\int^{\infty}_{1} x^6 \cdot \frac{\exp (-\frac{x^2}{2})} {\sqrt{2 \pi}} \,dx$$ The answer in the book suggests to do the same procedure but with truncated version. This doesn't help much as $$\mathbb{E}(x)$$ is obviously larger in this case but the integral is smaller. (I suspect that there is an error in the book but it is not the point of the question).

Question. Are there ways how truncated distribution can be helpful in principle in such cases where we can see nice distribution to sample from?

(Notice also that it is not the question about homework. I can get this integral as numerically, so by rejection sampling. Its value is around 7.5, not 47 as book suggests. I'm asking because I miss some conceptual understanding of the matter).

• the book has a bit different formula in the example, namely, it has $x^3$. – garej Jul 9 at 12:17
• @garej, I think there is the typo too. All other examples use $x^6$ and follow the same logic. – iot Jul 16 at 18:32
• The truncated integral is not an expectation, because the function $\exp(-x^2/2)/\sqrt{2\pi}$ is not a valid probability density on the interval $[1,\infty):$ it lacks the normalization constant. What prevents you from applying your first solution by sampling from the standard Normal distribution restricted to $[1,\infty)$? – whuber Jul 16 at 20:17
• "MMA" would be what, exactly? If it's a procedure (and not just black-box software), you can't blame it, because you get to determine what you do! – whuber Jul 16 at 22:29