Quick Start

Installing Forecast.jl

To begin exploring the package functionality type the lines below in the Julia REPL:

Pkg> add https://github.com/viraltux/Forecast.jl

julia> using Forecast

Alternatively you can also type:

julia> using Pkg

julia> Pkg.add(url="https://github.com/viraltux/Forecast.jl")

julia> using Forecast

LOESS extrapolated

The example below compares LOESS result with extrapolated predictions compared to a simple moving average result with a window size of 100.

using Plots
using Forecast

n = 1000
axb = LinRange(-1/2,pi+1/2,n)
x = LinRange(0,pi,n)
y = sin.(x) .+ rand(n)
scatter(x, y, xlims=(-1/2,pi+1/2), ma=.5, label = "Data", color = :grey)
plot!(axb,loess(x,y,predict=axb), linewidth = 4, label = "LOESS", color = :blue)
plot!(x,sma(y,100,true), linewidth = 2, label= "Moving Avg 100", color = :orange)

STL on CO2 dataset

For this example we will be using the co2 data used by the creators of STL to demostrate its funcitonality, below we can see such time series.

using Plots
using Forecast

plot(co2(), legend=:bottomright)

The parameters used for STL they're also from the orginal paper, a period of 365 days is used (removing leap years extra day), a robust fit is required and seasonality post-smoothing is applied.

using Plots
using Forecast

stl_co2 = stl(co2(),365; robust=true, spm=true)