Zodiac-ts
Zodiac-ts is a time series library written in Javascript. Currently, it implements the following algorithms :
- Simple exponential smoothing;
- Double exponential smoothing;
- Holt Smoothing;
- Holt Winters smoothing.
Coming soon :
- Moving average
How to use Zodiac-ts ?
- You can install it using npm, by writting : npm install zodiac-ts
- Or you can simply clone it using git clone
zodiac = ;var data = 25 29 24 21 26 23 27 25 21 24 26 29 25; //Case of simple exponential smoothingvar alpha = 04; var ses = data alpha;var forecast = ses; //return an array with estimated values until t+1 //You can optimize alpha valuevar optimizedAlpha = ses; //You have to pass the number of iterations as parameter//After the optimization, the value of alpha is directly set to optimizedAlpha //You can predict again with the optimized value of alphavar optimizedForecast = ses; //Case of double exponential smoothingvar des = data alpha;forecast = des; //You have to pass the horizon of the prediction //You can also optimize alpha valueoptimizedAlpha = des;//After the optimization, the value of alpha is directly set to optimizedAlpha //Case of Holt smoothingvar gamma = 03;var hs = data alpha gammaforecast = hs;console;var optimizedParameters = hs; //return an object containing the optimized value of alpha and gamma//After the optimization, the value of alpha and gamma are directly set to the optimized values //Case of Holt Winters smoothingvar delta = 05;var seasonLength = 4;var multiplicative = false; //indicates if the model is additive or multiplicative var hws = data alpha gamma delta seasonLength multiplicative;forecast = hws;optimizedParameters = hws; //return an object containing the optimized values of alpha, gamma and delta//After the optimization, the value of alpha, gamma and delta are directly set to the optimized values