GithubHelp home page GithubHelp logo

juliadynamics / arfima.jl Goto Github PK

View Code? Open in Web Editor NEW
50.0 4.0 1.0 462 KB

Simulate stochastic timeseries that follow ARFIMA, ARMA, ARIMA, AR, etc. processes

License: MIT License

Julia 100.00%
stochastic timeseries arfima arima arma autoregressive moving-average

arfima.jl's Introduction

JuliaDynamics

This repository serves the following purposes:

  • Contains the source code for the JuliaDynamics website in the src and build folders.
  • Hosts the website via GitHub-pages and Jekyll.
  • Contains tutorials for all packages of JuliaDynamics in the tutorials folder.
  • Contains video resources for all packages of JuliaDynamics in the videos folder.

The website was modeled after the website of QuantumOptics.jl and most code that builds the site was re-used from the repository of QuantumOptics.jl (with permission).


To build locally do follow the instructions from here: https://jekyllrb.com/docs/

(install Jekyll and then do bundle exec jekyll serve which serves by default to http://localhost:4000)

arfima.jl's People

Contributors

danielvandh avatar datseris avatar github-actions[bot] avatar imgbot[bot] avatar juliatagbot avatar wildart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

wildart

arfima.jl's Issues

Math image in README is hard to read in dark mode

Here's what it looks like:

ccb241f3225f1ebd04f5c283ff8163c6

Is it possible to somehow render this to be dark mode friendly, e.g. with LaTeX directly? I tried something like

$$\underbrace{\left(1 - \sum_{i=1}^p \varphi_i B^i\right)}_{\text{\textcolor{blue}{auto-regressive}}}\underbrace{\left(1 - B\right)^{\overbrace{d}^{\text{\textcolor{purple}{fractional if $d \in \mathbb R$}}}}}_{\text{\textcolor{orange}{integrated}}} \underbrace{X_t}_{\text{\textcolor{gray}{generated timeseries}}} = \underbrace{\left(1 - \sum_{i=1}^q \theta_i\theta^i\right)}_{\text{\textcolor{green}{moving average}}}\underbrace{\varepsilon_t}_{\text{\textcolor{red}{white noise}}},$$

but that's worse, obviously (since GitHub can't get the actual packages needed to create the same type of image).

Inconsistency with explicit ARMA simulation

I'm not sure what I am doing wrong in the source code for ARFIMA.jl, but take the following explicit simulation of an ARMA process and compare it with its ""equivalent" ARFIMA.jl syntax:

using Random
Random.seed!(77163)
η = randn(5000)
s = ones(5000)
for n in 4:5000
    s[n] = 1.625s[n-1] - 0.284s[n-2] - 0.355s[n-3] + η[n] - 0.96η[n-1]
end
s ./= std(s)

using ARFIMA
φ = SVector(1.625, -0.284, -0.355)
θ = SVector(0.96)
Random.seed!(77163)
s2 = arma(5000, 1.0, φ, θ)
s2 ./= std(s2)

using PyPlot
plot(s)
plot(s2)
xlim(0, 1000)

image

Both simulations have the characteristic oscillatory behavior of the specified ARMA process, but the one coming from ARFIMA.jl has much, much less noise.

Why...?

Stranbo integration

Leaving an issue here to consider whether we might integrate the functionalities I have in Stranbo and arfima.

Stranbo is designed for generating time series with "complicated" sarimax (integer $i$) processes. Complicated means many seasonal effects (think, daily + weekly + monthly + yearly, ..., each one with its own d, ar, and ma coefficients) and/or many auxiliary components (again, each one with its own d, ar, and ma coefficients).

It is slower than ARFIMA, a little bit due to the generality, and a tad due to the fact that I don't use any @fastmath tricks (I got scared because of this kind of things, but maybe here it's safe?).

The high-picture view of how Stranbo work is:

  1. define all processes components as classes
  2. detine a process as an vector of components
  3. gather all coefficients, and expand the polynomials for x, z, and the auxiliary components using Polynomials
  4. For each x[t]
    4.1 use a modified getindex to look in the past (modified so to handle negative indices without padding)
    4.2 dot product coefficients and backward shifted (and truncated) series
    4.3 sum up
  5. (eventually add anomalies...)

I believe that 4 is in mostly shared between the two packages (but I can learn a bit to improve even more). I don't think the polynomial stuff is in ARFIMA (I believe you have hardcoded the loops, right?).

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

SARIMAX

Hello,

would you be open on adding X into SARIMA model to get also SARIMAX? The only option as of now is statsmodels in python. I don't count using R as an option. https://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.sarimax.SARIMAX.html
Which is alright, but it is terribly slow, because the whole implementation is just in python. I was thinking about writing SARIMAX from scratch in rust language, but that would be indeed nontrivial amount of work. I found your package and it looks very well, except missing the input for exogenous variables.

image
Source: https://towardsdatascience.com/time-series-forecasting-with-arima-sarima-and-sarimax-ee61099e78f6

Would you be open to this feature?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.