Transitional densities and the Kolmogorov equations


Examples

Cubic diffusion with unimodal transition density

\[ dX_t = -X_t^3dt + dB_t \]

library("DiffusionRimp")
# Set the parameters of the problem:
Xs   <- 1
s    <- 0
t    <- 5
lims <- c(-3, 3)
delt <- 0.0025
nodes<- 101

# Define drift and diffusion terms:
mu  <- function(X,t){-X^3}
sig <- function(X,t){1}
# Approximate the transitional density:
res <- MOL.density(Xs, s, t, lims, nodes, delt)

# Plot the density:
persp(res$Xt, res$time, pmin(res$density, 1), col = 'white', xlab = 'State (X_t)',ylab='Time (t)',
    zlab='Density f(X_t|X_s)', border = NA, shade = 0.5, theta = 145)

Cubic diffusion with multimodal transition density

\[ dX_t =X_t(1 -X_t^2)dt + dB_t \]

# Define drift and diffusion terms:
mu  <- function(X,t){X-X^3}
sig <- function(X,t){1}
# Approximate the transitional density:
res <- MOL.density(Xs, s, t, lims, nodes, delt)

# Plot the density:
persp(res$Xt, res$time, pmin(res$density, 1), col = 'white', xlab = 'State (X_t)',ylab='Time (t)',
    zlab='Density f(X_t|X_s)', border = NA, shade = 0.5, theta = 145)

Time-inhomogenous drift and volatility

\[ dX_t =X_t((1+\cos(2\pi t)) -X_t^2)dt + (1+0.25\sin(3 \pi t))dB_t \]

# Define drift and diffusion terms:
mu  <- function(X,t){X*((1+cos(2*pi*t))-X^2)}
sig <- function(X,t){(1+0.25*sin(3*pi*t))}
# Approximate the transitional density:
res <- MOL.density(1, 0, 5, c(-3, 3), 101, 0.0025)

# Plot the density:
for(i in 0:1)
{
  persp(res$Xt, res$time, pmin(res$density, 1), col = 'white', xlab = 'State (X_t)',ylab='Time (t)',
    zlab='Density f(X_t|X_s)', border = NA, shade = 0.5, theta = 145+i*60)
}

A bivariate example: Cubic diffusion with oscillating spin

\[ \begin{aligned} dX_t &=[X_t(1 -X_t^2)+\sin(0.5\pi t)Y_t]dt + 0.5dB_t^{(1)}\\ dY_t &=[Y_t(1 -Y_t^2)-\sin(0.5\pi t)X_t]dt + 0.5dB_t^{(2)}\\ \end{aligned} \]

 # Set the parameters of the problem:
 Xs     <- 1            # Starting X-coordinate
 Ys     <- 1            # Starting Y-coordinate
 s      <- 0            # Starting time
 t      <- 10           # Final horizon time
 Xlim   <- c(-2.2,2.2)  # Lattice endpoints in X dim
 Ylim   <- c(-2.2,2.2)  # Lattice endpoints in Y dim
 Nodes  <- 51           # How many nodes (incl. ends)
 delt   <- 1/100        # Time stepsize
 
 # Define drift and diffusion terms:
 mu1   <- function(X,Y,t){X*(1-X^2)+sin(2*pi*t/4)*Y}
 mu2   <- function(X,Y,t){Y*(1-Y^2)-sin(2*pi*t/4)*X}
 sig11 <- function(X,Y,t){0.5}
 sig22 <- function(X,Y,t){0.5}
 
 # Run the Method of Lines:
 res <- BiMOL.density(Xs, Ys, s, t, Xlim, Ylim, Nodes, delt)
 
 library("colorspace")
 colpal=function(n){rev(c(sequential_hcl(n-1,power=0.8,l=c(40,100)),'white'))}
  
 for(i in c(251,501,751,1001))
 {
   filled.contour(res$Xt, res$Yt, res$density[,,i], color.palette = colpal,
                  main = paste0('Transition Density \n (t = ', res$time[i],')'),
                  xlab='Xt',ylab='Yt')
 }


Further reading

browseVignettes('DiffusionRimp')

References