I was trying to do some time series analysis. In R, there is a `decompose`

function that can decompose a time series into trend, seasonality, and random noise.

Is there an equivalent in Julia?

I was trying to do some time series analysis. In R, there is a `decompose`

function that can decompose a time series into trend, seasonality, and random noise.

Is there an equivalent in Julia?

4 Likes

https://github.com/baggepinnen/SingularSpectrumAnalysis.jl does this, but in a perhaps slightly different way than what you are looking for.

6 Likes

Itâ€™s not clear how to do it from the readme. Feels like itâ€™s not beginner friendly yet and it requires much higher level of maths and skills to understand.

1 Like

Sounds like an idea for a new package?

R implements holt winters method. This paper may be helpful.

5 Likes

Time for a time series person to step in! I thought Julia sells alot to wall st. And they do time series alot. My needs are met by R for now. Data so small that I can just do it without thinking about performance

I donâ€™t think a package to run this regression in what makes them choose programming language, tbh Also, Julia doesnâ€™t sell anything, Julia Computing does.

1 Like

I asked a similar question a while ago, and apparently there isnâ€™t any. I have implemented Hamilton (2017) for detrending, and plan to release it soon. I also came up with a simple multilevel model-based deseasonalizer that seems to work surprisingly well, but that is still experimental.

As I said in the other topic, most of these methods introduce spurious patterns, especially for the â€śtrendâ€ť. Deseasonalizing with sophisticated algorithms (STL or X13-ARIMA-SEATS) is also prone to this, to a smaller extent. But of course they are OK for exploratory plotting, one just has to be aware of this.

6 Likes

if times is what you do then yeah.

My point is that they are probably able to build their own code base where something like this enters as a component, rather than relying on some public open source compromise. Of course if thereâ€™s a great solution out there they might use it, but it wonâ€™t hold them back.

Has the landscape changed on this? Iâ€™m looking for the same thing and canâ€™t find a solution that doesnâ€™t involve using R : (

I added some additional documentation here

https://github.com/baggepinnen/SingularSpectrumAnalysis.jl#simple-usage

Let me know whether or not it works for you, I might be able to add more functionality if you miss something

6 Likes

Thanks!

@baggepinnen Everything works great but it doesnâ€™t look like the package is exporting a `fit_trend`

function as indicated in the docs (I get `UndefVarError: fit_trend not defined`

). Running `names(SingularSpectrumAnalysis)`

yields the following output:

```
11-element Array{Symbol,1}:
:SingularSpectrumAnalysis
:analyze
:autogroup
:elementary
:hankel
:hankelize
:hsvd
:pairplot
:pairplot!
:reconstruct
:sigmaplot
```

Thanks! First try to update your packages: `] up`

If that does not work, try `] add SingularSpectrumAnalysis#master`

. I just added the functionality so it might not have made it into the registry yet

3 Likes

ah, got it. Thanks again!

STL in R has always been my go-to function for timeseries decomposition. I think I can safely replace that now. Thanks for making this package.

3 Likes

Hi,

I just released the first version for TSAnalysis (https://github.com/fipelle/TSAnalysis.jl). It is a rather small package (at least, for now) but it can be used to decompose time series into trends, cycles and other components using linear state-space models.

I added an example with seasonality in the GitHub readme. I hope this can also help!

5 Likes

SingularSpectrumAnalysis has been updated to support use of the robust factorizations provided by TotalLeastSquares.jl. It should now be able to handle extremely large outliers and missing data quite well.

11 Likes

It would be great if someone could make X13ARIMA-SEATS, public domain Fortran that the government uses for seasonal adjustment, available in julia:

1 Like

That someone could be you

If the code is public domain you can just port the whole thing, alternatively consider writing a Julia wrapper around the FORTRAN library

5 Likes