# Simulating conditional expectations

There is a multidimensional process X defined via its SDE (we can assume that its a diffusion type process), and lets define another process by $g_t = E[G(X_T)|X_t]$ for $t\leq T$.

I would like to simulate process $g_t$, i.e. discretize to use in a Monte-Carlo simulation. What is the best way to do it?

The two approaches I can think of is (i) use Feynman-Kac and Finite Differeces to get $g_t$ as a function of $X$ and $t$, simulate $X_t$ and calculate $g_t$ (ii) use some form of Longstaff-Schwarz algorithm

Is there any better/simpler method?

EDIT: I think I was not clear enough with my question. I am trying to estimate a stopping time when the process $g_t$ hits a given barrier $b$, so in order to do that I need to simulate the whole path of $g_t$. It is easy to simulate $X_t$ for any time t, but then to get $g_t|X_t$ I would need to run another monte carlo (within the monte carlo) for every path and every time step of the original monte carlo, which is probably going to take too much time. Longstaff-Schwarz algorithm is used for american options exactly because of this reason - to use a quick heuristic instead of nested monte carlo simulations...

EDIT 2: Let me include some pseudo-code

for(int i=0; i<NoRuns; ++i)
{
X_t = initial value;
g_t = g(0, X_t); //TODO - how to calculate g_t?
t=0;
for(int j=0; j<NoSteps; ++j)
{
t+=dt;
X_t = move X_t by dt, using e.g. Euler scheme
g_t = g(t, X_t); //TODO - how to calculate g_t?
if (g_t<= barrier) report(t, X_t, g_t);
}
}


The bits I am not sure how to implement are the lines:

g_t = g(0, X_t); //TODO - how to calculate g_t?

-
if your dimension is high I would not recommend finite difference scheme, (I repeat) no optimal stopping problem so Logstaff and Schwartz isn't of any help here. –  TheBridge Dec 21 '11 at 7:42
as nothing depends on i and j in the loops of your pseudo code it is still not completly clear what you want to do. Can you add that to it ? –  TheBridge Dec 21 '11 at 23:55

If you can simulate $N$ times independent realisations of $X_T|X_t$ then SLLN says that : $\tilde{g}^N_t=\sum_{i=1}^N\frac{1}{N}G(X_T)|X_t\to \mathbb{E}[G(X_T)|X_t]$ almost surely this is classical and often the only way to get $\mathbb{E}[G(X_T)|X_t]$ for high dimensional process $X$. You can even use CLT to get a confidence interval for $\tilde{g}_t$