ARFIMA estimation in Julia

Is there a package able to estimate an ARFIMA model in Julia (or just ARIMA for a start)?

I believe that the ARFIMA.jl package is just for simulating stochastic time-series that follow an ARFIMA process. Thank you in advance.

@s-broda’s ARCHModels.jl can fit ARMA{p,q} models (but not yet ARIMA or ARFIMA).

julia> using ARCHModels;
julia> fit_arma(df, p, q) = fit(ARCH{0}, df, meanspec=ARMA{p,q});
julia> fit_arma(BG96, 2, 3)
TGARCH{0,0,0} model with Gaussian errors, T=1974.
Mean equation parameters:
────────────────────────────────────────────────
       Estimate  Std.Error     z value  Pr(>|z|)
────────────────────────────────────────────────
c   -0.00983746  0.0354041  -0.277862     0.7811
φ₁   0.551574    0.589292    0.935995     0.3493
Ο†β‚‚  -0.144346    1.92247    -0.0750838    0.9401
θ₁  -0.542057    0.591114   -0.91701      0.3591
ΞΈβ‚‚   0.113263    1.92454     0.0588521    0.9531
θ₃   0.0501891   0.0282235   1.77828      0.0754
────────────────────────────────────────────────
Volatility parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
Ο‰  0.220462  0.0117617  18.7441    <1e-77
─────────────────────────────────────────
julia>

Also self-tuning:

julia> auto_arma(df, bic) = selectmodel(ARCH{0}, df, meanspec=ARMA, criterion=bic, minlags=1, maxlags=3);
julia> auto_arma(BG96, bic)       # ARMA(1,1)
TGARCH{0,0,0} model with Gaussian errors, T=1974.
Mean equation parameters:
─────────────────────────────────────────────
      Estimate  Std.Error   z value  Pr(>|z|)
─────────────────────────────────────────────
c   -0.0266446  0.0174716  -1.52502    0.1273
φ₁  -0.621838   0.160741   -3.86857    0.0001
θ₁   0.643588   0.154303    4.17095    <1e-4
─────────────────────────────────────────────
Volatility parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
Ο‰  0.220848  0.0118061  18.7063    <1e-77
─────────────────────────────────────────
julia> auto_arma(DOW29[:,1], bic) # ARMA(2,2)
TGARCH{0,0,0} model with Gaussian errors, T=2785.
Mean equation parameters:
───────────────────────────────────────────────
      Estimate  Std.Error     z value  Pr(>|z|)
───────────────────────────────────────────────
c   -0.166748   0.0681206   -2.44783     0.0144
φ₁   0.0178542  0.0401341    0.444864    0.6564
Ο†β‚‚  -0.932372   0.0803993  -11.5968      <1e-30
θ₁  -0.0191798  0.0463979   -0.413375    0.6793
ΞΈβ‚‚   0.903732   0.0963863    9.37614     <1e-20
───────────────────────────────────────────────
Volatility parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
Ο‰   3.65185   0.220716  16.5455    <1e-60
─────────────────────────────────────────
julia> auto_arma(DOW29[:,3], bic) # ARMA(2,1)
TGARCH{0,0,0} model with Gaussian errors, T=2785.
Mean equation parameters:
────────────────────────────────────────────────
       Estimate  Std.Error     z value  Pr(>|z|)
────────────────────────────────────────────────
c    0.00192406  0.0345892   0.0556262    0.9556
φ₁  -0.371152    0.2418     -1.53496      0.1248
Ο†β‚‚  -0.145134    0.0625429  -2.32055      0.0203
θ₁   0.231451    0.235409    0.983186     0.3255
────────────────────────────────────────────────
Volatility parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
Ο‰   2.20732   0.164313  13.4336    <1e-40
─────────────────────────────────────────
julia> auto_arma(DOW29[:,9], bic) # ARMA(1,2)
TGARCH{0,0,0} model with Gaussian errors, T=2785.
Mean equation parameters:
──────────────────────────────────────────────
      Estimate  Std.Error    z value  Pr(>|z|)
──────────────────────────────────────────────
c   -0.0184696  0.0215819  -0.855789    0.3921
φ₁   0.109868   0.306715    0.358211    0.7202
θ₁  -0.110765   0.308797   -0.358699    0.7198
ΞΈβ‚‚  -0.107618   0.0347561  -3.09639     0.0020
──────────────────────────────────────────────
Volatility parameters:
─────────────────────────────────────────
   Estimate  Std.Error  z value  Pr(>|z|)
─────────────────────────────────────────
Ο‰   1.79002   0.109611  16.3307    <1e-59
─────────────────────────────────────────
2 Likes

You can look at my post for an attempt to summarize the TS ecosystem in Julia:

there are others…

3 Likes

PS: while the Julia ecosystem has (multiple) options to estimate ARIMA/sARIMA/VARIMA, I don’t know any options to estimate an ARFIMA yet (only to simulate).
Sometimes when I’m feeling greedy I code it up on my own & submit a PR :wink:…

1 Like

If you’re okay with writing a little code on your own and are treating the white noise forcing as Gaussian, then the spectral densities of (AR)(F)(I)(MA) processes are all pretty direct to work out and would only take a few lines of code to write. You could then write a Whittle-type likelihood approximation (or the β€œdebiased” alteration) in just a few more lines of code, which you could then plop into any optimizer you wanted.

Alternatively, presumably it would be possible to use your spectral density and with a few more intermediate calculations plug in to @willtebbutt TemporalGPs package. I have never used it, though, and so maybe I’m wrong about that.

2 Likes