The MittagLeffleR R package
The first type Mittag-Leffler distribution is a heavy-tailed distribution, and occurs mainly as a waiting time distribution in problems with “fractional” time scales, e.g. times between earthquakes.
The second type Mittag-Leffler distribution is light-tailed, and “inverse” to the sum-stable distributions. It typically models the number of events in fractional systems and is used for time-changes of stochastic processes, e.g. anomalous diffusion processes.
You can install MittagLeffleR from CRAN via
install.packages("MittagLeffleR")
library(MittagLeffleR)
Install the devtools
package first, then
# install.packages("devtools")
::install_github("strakaps/MittagLeffler")
devtoolslibrary(MittagLeffleR)
See reference manual.
Generate a dataset first:
library(MittagLeffleR)
= rml(n = 10000, tail = 0.9, scale = 2) y
Fit the distribution:
logMomentEstimator(y, 0.95)
#> tail scale tailLo tailHi scaleLo scaleHi
#> 0.8998758 2.0170711 0.8995285 0.9002230 2.0151044 2.0190378
Read off
Standard Brownian motion with drift (1) has, at time (t), has a normal probability density (n(x|= t, ^2 = t)). A fractional diffusion at time (t) has the time-changed probability density
[p(x,t) = n(x| = u, ^2 = u)h(u,t) du]
where (h(u,t)) is a second type Mittag-Leffler probability density with scale (t^). (We assume (t=1).)
library(ggplot2)
library(tidyr)
<- 0.65
tail <- 0.01
dx <- seq(-2,5,dx)
x <- 3^(-1:2)
t # cut off time so that only 1 % of probability is lost
<- qml(p = 0.99, tail = tail, scale = max(t), second.type = TRUE)
umax <- seq(0.01,umax,dx)
u <- outer(u,t, function(u,t) {dml(x = u, tail = tail, scale = t^tail)})
H <- outer(x,u,function(x,u){dnorm(x = x, mean = u, sd = sqrt(u))})
N <- N %*% H * dx
p <- data.frame(p)
df names(df) <- sapply(t, function(t){paste0("T=",round(t,2))})
'x'] <- x
df[%>%
df gather(key = "time", value = "density", -x) %>%
ggplot(mapping = aes(x=x, y=density, col=time)) +
geom_line() +
labs(ggtitle("Subdiffusion with drift"))
See the page strakaps.github.io/MittagLeffleR/articles/ for vignettes on