Solving the Ornstein–Uhlenbeck SDE With an Integrating Factor
Original question
Can you derive the solution to the Ornstein-Uhlenbeck stochastic differential equation using the integrating factor method?
For dXt=κ(θ−Xt)dt+σdWt with κ>0, centre the process at θ and multiply by eκt. The resulting equation has zero drift. Integrating and undoing the transformation gives
Integrate this equality from s to t and multiply by e−κt. Conditional on information at s, the stochastic integral over (s,t] is a centred Gaussian because the integrand is deterministic and the future Brownian increments are independent of the past. With h=t−s, the conditional mean is θ+(Xs−θ)e−κh and the Itô isometry gives the variance:
σ2∫ste−2κ(t−u)du=2κσ2(1−e−2κh).
This also gives an exact simulation update. Draw a standard normal, multiply it by the conditional standard deviation and add the conditional mean.
Centre the process at θ before choosing the factor. The drift of the centred process is −κ(Xt−θ), so differentiating eκt contributes precisely the term needed to cancel it. After integrating, divide both the initial term and the stochastic integral by eκt. Inside the integral, the surviving factor e−κ(t−s) makes an older shock count less than a recent shock. Since the integrand is deterministic, the integral is Gaussian and its variance comes from integrating the squared kernel.
For a forecast from time s, restart the solution at the observed Xs and integrate only over Brownian increments after s. The conditional mean is θ+(Xs−θ)e−κ(t−s). The noise integral has mean zero given the past. For its variance, integrate e−2κ(t−u) from u=s to u=t, then multiply by σ2. The factor of two is there because the exponential kernel is squared. As the forecast horizon grows, this variance tends to σ2/(2κ) for κ>0.
Use the kernel to calculate a conditional forecast
For an original exercise, use κ=1.2, θ=0.03, σ=0.01 and X0=0.05. Over half a year, the conditional mean is 0.03+0.02e−0.6≈0.04098. The variance is 0.012(1−e−1.2)/2.4≈0.0000291, giving a standard deviation of about 0.00540. If these are rates quoted as decimals, the mean is about 4.10% and the standard deviation is 0.54 percentage points. The long-run standard deviation is 0.01/2.4≈0.00645, larger than the half-year value because more shocks can accumulate.
If you start the model at a normal random value with mean θ and variance σ2/(2κ), independent of the future Brownian increments, the initial variance decays by e−2κt. The new shocks contribute the complementary amount. The marginal distribution then stays the same at every time, which explains why the long-run variance is also the stationary variance.