0

Let's say we have random variable $H \sim\cal N(0, 1)$. We take 1000 samples of this distribution. Then, for each $h$, we calculate $x=f(h)$. ($f$ is some complicated function). How can I calculate the expected value of x?

Abe
  • 3
  • 1
  • See this link for more efficient method than MC-sampling: https://stats.stackexchange.com/questions/434669/expectation-of-ln1-ex-where-x-is-normally-distributed/434688#434688 – Jesper for President Apr 22 '21 at 19:43

2 Answers2

1

If you want to calculate the expected value of $x$ numerically, it is quite simple. The result is $$E[x]=\frac{1}{1000}\sum_{i=1}^{1000}f(h_i),$$ where $h_i$ is the $i$-th sample.

If you want to calculate it analytically, there is no general way unless you give a specific $f$

Weimin
  • 11
  • 2
1

If you want to calculate the expected value analytically, you can use the law of the unconscious statistician. $H\sim N(0,1)$ and $X=f(H)$, then: \begin{align} E(X)=\int_{-\infty}^{\infty}f(h)\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}h^2}\mathrm{d}h \end{align} However, if $f(h)$ is complicated, there may be no analytical solution or it may be very difficult to calculate. But you can also simulate the expected value. Simulate $n$ independent standard normal distributed random variables $h_i$. Then calculate $x_i=f(h_i)$. A consistent estimator for $E(X)$ is given by: \begin{align} \frac{1}{n}\sum_{i=1}^nf(h_i) \end{align}

Lars
  • 1,078
  • 1
  • 2
  • 14