How to solve a stochastic integral in python

1.2k Views Asked by At

I need to implement (solve) a stochastic integral in python. I have observations of a time series X, assumed to behave like Brownian motion with drift, which changes from zero to a known constant V at some time Tc which is given by the smallest time t for which :

$ \int_0^t e^{a(Xt-Xs)+b(t-s)}ds > K $

for some known constants a,b and K

How can this be solved on paper? It is confusing that the integral is with respect to ds and not dW. While Xs is assumed to be a BM with change of drift at t, all I have are some observations. Also, is there a preferred way of implementing equations like these programatically? Any resources (maybe for numerical estimation etc) would be great.

1

There are 1 best solutions below

0
On BEST ANSWER

Given that the integral doesn't contain the dW term, I am not sure if it should even be called a stochastic integral. Also, itegrals of stochastic functions (Xt here) require simulations to solve them as the integral isn't deterministic. In this case, however, I already have observations of Xt. So I think the way to implement this procedure/equation would be simply to replace the above integral with a summation (using $\Delta t=1$)

$\sum_0^t(e^{a(Xt−Xs)+b(t−s))}$, plug in the observed values of X0...Xt for various values of t and see for which t this becomes >K