# ARFIMA.jl - proof of concept of Julia's multiple dispatch

**URL:** <https://discourse.julialang.org/t/arfima-jl-proof-of-concept-of-julias-multiple-dispatch/29726>\
**Category:** Package Announcements\
**Created:** [October 10, 2019, 12:55pm UTC](https://discourse.julialang.org/t/arfima-jl-proof-of-concept-of-julias-multiple-dispatch/29726 "2019-10-10T12:55:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [October 10, 2019, 12:55pm UTC](https://discourse.julialang.org/t/arfima-jl-proof-of-concept-of-julias-multiple-dispatch/29726/1 "2019-10-10T12:55:28Z")

</div>

Hello all,

ARFIMA is a process that generates stochastic timeseries. It is a generalization of various other known processes, like ARMA, ARIMA, AR, etc…

for a long time I needed to write some code to simulate ARFIMA processes (including the F) but I’ve always put it under the rug.

Now (after obtaining some basic code, and also being inspired by some recent post on [ARIMA using Turing.jl](https://towardsdatascience.com/arima-models-with-turing-jl-81dcf2a1094c)) I wrote what I needed. I realized that the ARFIMA processes are an excellent test case for showcasing Julia’s multiple dispatch. Here is the process:

 ![ARFIMA](https://global.discourse-cdn.com/julialang/original/3X/2/6/269af69711389c0e55c60f206cec3a17da104974.png)

What happens in this processes is that the various components can be added or removed entirely interchangeably and independently. This seems to be a job fitting multiple dispatch.

And so, that is the case. In the tini-tiny package [ARFIMA.jl](https://github.com/Datseris/ARFIMA.jl) a function `arfima` is exported, with call signature:

```julia
arfima([rng,] N, σ, d, φ=nothing, θ=nothing) -> Xₜ

```

Depending on the type of `d, φ, θ`, the code either uses the corresponding component or not. For more information please see the documentation string of `arfima` (also stated in the README).

* * *

What you will notice is that this is package is **not published** , simply because it is untested. I do not know whether something is incorrect in the code, because I do not know what to test for. If you know tests to do with this package please consider contributing them via a PR!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 10, 2019, 1:15pm UTC](https://discourse.julialang.org/t/arfima-jl-proof-of-concept-of-julias-multiple-dispatch/29726/2 "2019-10-10T13:15:15Z")

</div>

> [@Datseris](#):
>
> I do not know what to test for

I don’t know much about ARFIMA, but for a subclass, eg ARIMA, you can test simulated vs theoretical moments (obtained from the Yule-Walker equations).

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [October 10, 2019, 4:33pm UTC](https://discourse.julialang.org/t/arfima-jl-proof-of-concept-of-julias-multiple-dispatch/29726/3 "2019-10-10T16:33:42Z")

</div>

Yea you can compute the unconditional and conditional moments of the process analytically in most cases. Just use Monte Carlo to verify that you indeed can produce the same moments using your code. For simple cases like AR or MA this should be straightforward.
