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

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) 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:

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 a function arfima is exported, with call signature:

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!


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).

1 Like

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.