# Approximation expectation integral

Suppose that I have a function $g(x): R \rightarrow R$ and suppose that the pdf of $x$ is $f(x)$. To avoid cumbersome numerical integration I approximate the expected value of $g(x)$ as

$\int_{x = -\infty}^{\infty} g(x) f(x) = \frac{1}{R} \sum_{r=1}^R g(x_r)$,

with the right hand side evaluated in $R$ random draws from $f(x)$.

Is it somehow possible to apply a similar trick when I have $\overline{x}$ as the lower bound of the integration? (the domain of $g(x)$ remains $R$)

$\int_{x = \overline{x}}^{\infty} g(x) f(x)$

Yes, just choose those $R$ draws that are more than $\bar{x}$ (but still divide by $R$). The reason this works mathematically is you can write the bounded below integral as an unbounded integral with an indicator function.
$$\int_{\bar{x}}^{\infty} g(x) f(x) dx = \int_{-\infty}^{\infty} g(x) I_{\{x > \bar{x} \}} f(x) dx \approx \dfrac{1}{R}\sum_{r = 1}^{R} g(x_r) I_{\{x_r > \bar{x} \}}.$$
So if the draw from $f$ is more than $\bar{x}$, you evaluate $g$, otherwise, you throw it away.