-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06c0db8
commit ca88d00
Showing
1 changed file
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,53 @@ | ||
[![Build status](https://github.com/matthieugomez/InfinitesimalGenerators.jl/workflows/CI/badge.svg)](https://github.com/matthieugomez/InfinitesimalGenerators.jl/actions) | ||
|
||
This package provides a set of tools to work with Markov Processes defined on a 1-dimensional Gri | ||
|
||
|
||
|
||
# Markov Processes | ||
- `X = DiffusionProcess(x::AbstractVector, μ::AbstractVector, σ::AbstractVector)` creates the discretized Markov Process with drift `μ` and volatility `σ`, on a grid `x` with reflecting boundaries. | ||
- `generator(X)` returns its associated generator (i.e. the operator `f -> ∂_tE[f(x_t)|x_0=x]`) | ||
- `stationary_distribution(X)` returns its stationary distribution (i.e. the positive vector `g` such that `g * generator(X) = 0`) | ||
The package allows you to compute compute expectations involving Markov processes | ||
|
||
```julia | ||
using InfinitesimalGenerators | ||
# Create a diffusion process (here, the Ornstein–Uhlenbeck dx = -0.03 * x * dt + 0.01 * dZ_t) | ||
# Note that the package assumes reflecting boundaries at the limits | ||
x = range(-1, 1, length = 100) | ||
μx = .- 0.03 .* x | ||
σx = 0.01 .* ones(length(x)) | ||
X = DiffusionProcess(x, μx, σx) | ||
|
||
|
||
# Return its stationary distribution | ||
g = stationary_distribution(X) | ||
|
||
# Return the associated generator as a matrix (i.e. the operator `f -> ∂_tE[f(x_t)|x_0=x]`) | ||
MX = generator(X) | ||
|
||
# Use the generator to compute E[\int_0^T e^{-\int_0^t f(x_s)ds}f(x_s) + e^{-\int_0^T v(x_s)ds}ψ(x_T) | x_0 = x] | ||
feynman_kac(MX; t = range(0, 100, step = 1/12), f = zeros(length(x)), ψ = ones(length(x)), v = zeros(length(x))) | ||
``` | ||
|
||
# Additive Functionals | ||
- `M = AdditiveFunctional(X, μm, σm)` creates, given a discretized Markov Process, the Additive Functional with drift `μm` and volatility `σm` | ||
- `generator(M)` returns its associated generator (i.e. the operator `f -> ∂_tE[e^{m}f(x_t)|x_0=x]`) | ||
- `cgf(m)` returns the long run scaled CGF of `m` | ||
- `tail_index(m)` returns the tail index of the stationary distribution of `e^m` | ||
|
||
|
||
|
||
# Derivative | ||
The package allows you to compute (lazyly) the first and second derivatives on a grid through finite difference schemes | ||
|
||
``` | ||
using InfinitesimalGenerators | ||
x = range(-1, 1, length = 100) | ||
f = sin.(x) | ||
FirstDerivative(x, sin, direction = :upward, bc = (0, 0)) | ||
FirstDerivative(x, sin, direction = :downward, bc = (0, 0)) | ||
SecondDerivative(x, sin, bc = (0, 0)) | ||
``` | ||
The argument `bc` refers to the value of the first-derivative at the limit | ||
|
||
|
||
## Related Packages | ||
- [SimpleDifferentialOperators](https://github.com/QuantEcon/SimpleDifferentialOperators.jl) contains more general tools to define operators with different boundary counditions. In contrast, InfinitesimalGenerators always assumes reflecting boundaries. |