# Density Tracking by Quadrature

Implementation of density tracking by quadrature (DTQ) algorithms for stochastic differential equations (SDEs). DTQ algorithms numerically compute the density function of the solution of an SDE with user-specified drift and diffusion functions. The calculation does not require generation of sample paths, but instead proceeds in a deterministic fashion by repeatedly applying quadrature to the Chapman-Kolmogorov equation associated with a discrete-time approximation of the SDE. The DTQ algorithm is provably convergent. For several practical problems of interest, we have found the DTQ algorithm to be fast, accurate, and easy to use.

Rdtq implements Density Tracking by Quadrature (DTQ) algorithms for stochastic differential equations. Suppose you have a stochastic differential equation of the form

dX(t) = f(X(t)) dt + g(X(t)) dW(t)

where W(t) is standard Brownian motion, and where f and g are user-specified drift and diffusion functions.

Let p(x,t) denote the probability density function of the random variable X(t). Then Rdtq will calculate a numerical approximation to p(x,T) for a fixed time T > 0.

There are three main reasons to use Rdtq to compute the density function of X(t):

1. Rdtq is simultaneously easy to use and flexible. The only functions the user has to write are those that return the drift f(x) and the diffusion g(x). In particular, the user does not have to specify the derivatives of these functions. Beyond these two functions, the user can specify the initial condition either in the form of a single point, X_0 = C, or in the form of a density function, p(x,0) at each grid point x. The user also has total control over the temporal and spatial grid spacings.

2. Rdtq is provably convergent, in the limit where the temporal and spatial grid spacings vanish. See H. S. Bhat and R. W. M. A. Madushani, "Density Tracking by Quadrature for Stochastic Differential Equations," arXiv:1610.09572.

3. Rdtq is fast. The package includes both C++ and sparse matrix implementations of the DTQ algorithm. In our tests at the finest grid resolutions, the DTQ method is approximately 100 times faster than a competing method that consists of numerically solving the Fokker-Planck/Kolmogorov partial differential equation.

## Installation

You can install Rdtq from github with:

## Example

Suppose you have the stochastic differential equation dX(t) = -X(t) dt + dW(t) and you would like to find the probability density function of X(t) at T=1. Here is how to do that using Rdtq. # Reference manual

install.packages("Rdtq")

0.1 by Harish S. Bhat, 2 years ago

Browse source code at https://github.com/cran/Rdtq

Authors: Harish S. Bhat , R. W. M. A. Madushani , Shagun Rawat

Documentation:   PDF Manual

GPL (>= 2) license

Imports Rcpp, Matrix

Suggests ggplot2, scales