Expectation of a random variable and an indicator function

1.7k Views Asked by At

Suppose you have a random variable $X$, and an event $A$. How do you evaluate the expectation $\mathbb E[X\ \mathbb{I}_{A}]$?

1

There are 1 best solutions below

2
On

Depends on what you mean by "evaluate." By definition, $$ \mathbb{E}\left[X\mathbb{I}_{A}\right]=\int_{A}X(\omega)\mathbb{I}_{A}(\omega)d\mathbb{P}(\omega)=\int_{A}X(\omega)d\mathbb{P}(\omega), $$ so to evaluate the expression, you would compute the integral above. Practically speaking, if you are performing a Monte Carlo simulation, the algorithm is as follows:

accumulator = 0
for n in [1, ..., N]:
    generate a sample omega from your distribution
    if omega is in A:
        accumulator += X(omega)
    endif
endfor
expectation = accumulator / N