Examples » Walker: Integrating the Dirichlet SDE

This example runs Walker to integrate the Dirichlet SDE (see DiffEq/Dirichlet.h) using constant coefficients. For more details on the Dirichlet SDE, see https://doi.org/10.1155/2013/842981.

Control file

This example runs the setup that was used in the paper Bakosi, Ristorcelli, A Stochastic Diffusion Process for the Dirichlet Distribution, Int. J. Stoch. Anal., 2013.

# vim: filetype=sh:
# This is a comment
# Keywords are case-sensitive

title "Dirichlet for the IJSA paper"

walker
  term  140.0   # Max time
  dt    0.05    # Time step size
  npar  10000   # Number of particles
  ttyi  1000    # TTY output interval

  rngs
    mkl_mrg32k3a seed 0 end
  end

  dirichlet     # Select Dirichlet SDE
    depvar y
    init zero
    coeff const
    ncomp 2  # = K = N-1
    b     0.1    1.5 end
    S     0.625  0.4 end
    kappa 0.0125 0.3 end
    rng mkl_mrg32k3a    
  end

  statistics
    <Y1>
    <Y2>
    <y1y1>
    <y2y2>
    <y1y2>
  end
end

Example run on a single CPU

Main/walker -v -c ../../tmp/dir.q

Results

Left – time evolution of the means and the means of the invariant distribution, right – time evolution of the components of the covariance matrix and those of the invariant.

Image
Image

Gnuplot commands to reproduce the above plots:

plot "stat.txt" u 2:3 w l t "<Y1>", "stat.txt" u 2:4 w l t "<Y2>", 0.5 lt 1, 0.2 lt 2
plot "stat.txt" u 2:5 w l t "<y1y1>", "stat.txt" u 2:6 w l t "<y1y2>", "stat.txt" u 2:7 w l t "<y2y2>", 1.0/44.0 lt 1, -1.0/110 lt 2, 4.0/275.0 lt 3