1

While trying to run a code which is paraphrasing the DE tutorial on SDE's, I'm getting the following stacktrace (only the first few lines):

Bridging distribution is unknown. Cannot use adapativity

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] (::DiffEqNoiseProcess.var"#106#108")(rand_vec::Vector{Float64}, W::NoiseProcess{Float64, 2, Float64, Vector{Float64}, Nothing, Nothing, DiffEqNoiseProcess.var"#105#107"{Vector{Float64}, Matrix{Float64}}, DiffEqNoiseProcess.var"#106#108", true, ResettableStacks.ResettableStack{Tuple{Float64, Vector{Float64}, Nothing}, true}, ResettableStacks.ResettableStack{Tuple{Float64, Vector{Float64}, Nothing}, true}, RSWM{Float64}, Nothing, RandomNumbers.Xorshifts.Xoroshiro128Plus}, W0::Int64, Wh::Vector{Float64}, q::Float64, h::Float64, u::Vector{Float64}, p::SciMLBase.NullParameters, t::Float64, rng::RandomNumbers.Xorshifts.Xoroshiro128Plus)
    @ DiffEqNoiseProcess ~/.julia/packages/DiffEqNoiseProcess/9NzQP/src/correlated_noisefunc.jl:28
  [3] reject_step!
    @ ~/.julia/packages/DiffEqNoiseProcess/9NzQP/src/noise_interfaces/noise_process_interface.jl:278 [inlined]
  [4] reject_step! (repeats 2 times)
    @ ~/.julia/packages/StochasticDiffEq/Ysmjy/src/integrators/integrator_utils.jl:7 [inlined]

I suspect this has to do with the way I am defining the correlated wiener processes. Here is the block of code I'm trying to run:

# Correlated Brownian motions
# e.g. Heston model

heston_tspan = (0.0,1.0)
μ = 1.0
κ = 1.0
Θ = 1.0
σ = 1.0
ρ = 0.333

function heston_drift!(du,u,p,t)
    du[1] = μ*u[1]
    du[2] = κ*(Θ-u[2])
end

function heston_sigma!(du,u,p,t)
    du[1] = √u[2]*u[1]
    du[2] = σ*√u[2]
end

correl = [1 ρ;ρ 1]
heston_noise = CorrelatedWienerProcess!(correl, heston_tspan[1], zeros(2), zeros(2))
heston_problem = SDEProblem(heston_drift!, heston_sigma!, ones(2), heston_tspan, noise=heston_noise)
heston_sol = solve(heston_problem)
plot(heston_sol)

EDIT: The solver works if I tell it to not use adaptive methods explicitly. For example,

heston_sol = solve(heston_problem, adaptive=false, dt=0.01)

However, I don't understand why

  1. There's no bridging distribution property defined for this CorrelatedWienerProcess! "object" (mathematically, it's similar to the default WienerProcess)
  2. The solve function's auto selector does not try a non-adaptive method when it fails to find a bridging distribution.
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Tom
  • 11
  • 3
  • "The solve function's auto selector does not try a non-adaptive method when it fails to find a bridging distribution." this is worth an issue. Yeah it's just non-standard noise processes have less machinery behind them right now. – Chris Rackauckas Nov 27 '21 at 11:18
  • I'll create an issue on the repository this week. Regarding the bridging distribution, I'd be willing to try and tackle that myself as well, but I'm still very green with Julia and still listening to a ton on YT videos (yours included) and trying out stuff on scripts, so it make take a while until I actually know enough for it. – Tom Nov 30 '21 at 11:34
  • I'm encountering a similar issue (using SABR dynamics, not Heston, but shouldn't be too different). Is there a workaround? Julia 1.9.0-rc2 with latest SciML packages. – sob Apr 17 '23 at 22:49
  • Just throwing this suggestion without much thought, but if your driving processes are Wiener, why not define the diffusion matrix to make them correlated as intended? It's a symmetric matrix with the correlation terms in the non-diagonal elements, if I remember correctly. If you have the other terms given by the SABR specification maybe there's a way of getting the final diffusion matrix by using the Cholesky decomposition (for example), given the property of correlated gaussian r.v.'s. – Tom Apr 18 '23 at 09:30
  • Additionally, you can use a non-adaptive method for integration. The integration schemes (and how to choose them when calling solve) are documented here:https://docs.sciml.ai/DiffEqDocs/latest/solvers/sde_solve/ – Tom Apr 18 '23 at 10:17
  • Thanks. I was able to get a result with adaptive set to false and a small fixed time step – sob Apr 18 '23 at 14:17

0 Answers0