Prediciendo cadenas de suministro

En este mes de julio asistí a varios congresos para presentar nuestros últimos resultados sobre predicción de cadenas de suministro.

En este contexto a menudo nos referimos a la demanda como lo que en realidad son ventas, debido a que la demanda verdadera nunca se observa cuando se producen roturas de stock. Esta situación ejemplifica la necesidad de métodos de estimación para señales censuradas desde arriba. Desde el punto de vista de los profesionales, la mayoría de las personas en la industria utilizan el Suavizado Exponencial (ETS en inglés) para predecir las ventas. Hemos desarrollado un Tobit ETS (o TETS) para predecir señales que están censuradas desde arriba y/o desde abajo. Hemos hecho las cuentas y hemos implementado la solución en un paquete llamado UComp, que está disponible en CRAN para R, en GitHub para MATLAB/Octave (https://github.com/djpedregal/UComp) y en PyPI para Python.

La siguiente figura muestra un caso extremo en el que los datos de AirPassengers de EE.UU. están artificialmente censurados tanto desde abajo como desde arriba. La línea negra representa los datos originales (‘demanda verdadera’), la línea azul es la misma información censurada artificialmente desde abajo y desde arriba, que es la información con la que el modelo tiene que estimar las predicciones, y la línea roja es el ajuste del modelo TETS. En otras palabras, dado solo la información restringida en azul, el modelo TETS logra estimar el ajuste en rojo más allá de los límites impuestos por las restricciones de los datos.

Automatic time series analytics with UComp!

Last August, 17th my paper on automatic identification of Unobserved Components models was finally published at the Journal of Statistical Software (https://www.jstatsoft.org/article/view/v103i09). The paper develops a methodology for running UC models without any prior assumptions. This methodology is implemented in UComp, a library written in several ‘languages’, like R, MATLAB/Octave and Python. R users may install the package from CRAN, MATLAB/Octave users may install it from GitHub (https://github.com/djpedregal), Python users should contact me directly.
There are many options to make a crafted manual estimation as well, with possibilities of automatic outliers identification, introduction of input variables, etc. Just have a go at it!
Any feedbacks are welcome!!

ISF2020

The 40th edition of the International Symposium of Forecasting 2020 just ended last Wednesday. It was initialled scheduled in June to be held at Rio de Janeiro, but we had to do it on-line (what a pity!).

I have contributed in two ways: i) giving a talk on session «Software and support systems II» entitled «Comprehensive automatic identification of Unobserved Components models», and ii) running a workshop on Thursday about «Modern State Space methods: a workshop for practitioners».

The talk was about UComp, a library for the automatic identification of structural unobserved components models (UC) useful both for time series decomposition and forecasting inspired by those of Andrew C. Harvey. The tool has been developed in C++ and is offered as a R package implemented with the help of the Rcpp api, and is also available as a MATLAB/Octave toolbox via mex files. Some of the salient features are: i) identification of models is done automatically by optimizing information criteria; ii) the type of models is more extense than usually assumed in this sort of models (damped trends, general ARMA coloured irregular components, etc.); iii) models allow for exogenous cycles and inputs; iv) automatic outlier detection is available; etc.

The workshop was about State Space modelling, and was mainly practical, covering some typical examples and more advanced as well, like Hodrick-Prescott filters, constant and time varying parameter regressions, dynamic harmonic regression, basic structural models, nesting in variables, time aggregation, hierarchical forecasting, and others. The last session was dedicated to the automatic identification of UC models with UComp.

UComp released!

It is my pleasure to tell you all that I have recently released UComp (at last!), a R package or MATLAB/Octave toolbox to run Unobserved Components models AUTOMATICALLY. That means that you do not have to assume any model because UComp suggests one to you based on information criteria (cool!).
You can install it from CRAN in the usual way (in R, here is the webpage if you want to see the manual) or download it from GitHub (for MATLAB/Octave, here also with a manual). By the way, you might also would like to have a look at my other projects, like SSpace or ECOTOOL.
There is also an example for UComp, sort of a vignette here for R users. Though, as a starter you may try the code at the end of this post.
Since the core functions are written in C++, just by doing some wrappers it can be «linked» to other usual «languages» (well, ok, I admit it is not so easy in the end). As a matter of fact, any contributor willing to do such wrappers in Python or any other language (Go, Julia, …) is very, very welcome, just let me know and we may have a word.

Just to start to use it try this:
install.packages(“UComp”)
library(UComp)
m = UC(log(AirPassengers))
plot(m$comp)

The same code in MATLAB/Octave would be:
load air passengers
M = UC(log(y), frequency);
plot(m.comp)

Enjoy!!

Nada es Gratis

Hoy ha salido un post en el blog Nada es Gratis de José I Castillo y un servidor (aquí) sobre la crisis económica y las predicciones macroeconómicas que se nos vienen encima como consecuencia de la pandemia. Es obvio darse cuenta que la dificultad de tales predicciones es enorme, por lo que allí ofrecemos una sencilla herramienta que permite a quien se la descargue plantear sus propios escenarios, de forma que puede obtener la predicción del PIB para 2020. ¡Que aproveche!

ECOTOOL in PLOS ONE

Finally the ECOTOOL toolbox for Matlab was published in PLOS ONE (Time series analysis and forecasting with ECOTOOL).
It embodies several routines for identification, validation and forecasting of dynamic models. The toolbox includes a wide range of exploratory, descriptive and diagnostic statistical tools with visual support, designed in easy-to-use Graphical User Interfaces, and may be downloaded from here.
It also incorporates complex automatic procedures for identification, exact maximum likelihood estimation and outlier detection for many types of models available in the literature (like multi-seasonal ARIMA models, transfer functions, Exponential Smoothing, Unobserved Components, VARX). You may estimate, for example, exponential smoothing or unobserved components models with automatic identification of outliers, something I have never seen before. You also may run the automatic identification of ARIMA models with two seasonalities (like diurnal and weekly)…
Just with a few lines of code you may run a comprehensive analysis of time series. The toolbox is supplied with an in-depth documentation system and online help, and it containes many demos that will guide you through the process of time series modelling.
Have a go at it and keep in touch!

39th International Symposium on Forecasting

This conference just closed this evening at Thessaloniki (Greece). A big event with a lot of interesting people giving interesting talks, with a mixture of traditional greek dancing and many other exciting thigs to do / see / share.

I spoke about a library that hopefully will appear a soon as possible on the automatic identification of Unobserved Components (UC) models. The idea is as simple and as basic as saying that there are automatic identification algorithms for every sort of model around, except for UC models. However, such a simple idea is much more complex that one may think, especially if one is trying to do it in C++. The slides with preliminary results here.

SSpace tutorial

This entry is really a link to a short tutorial on how to deal in practice with SS systems with the help of SSpace in MATLAB.

SSpace is a piece of software designed to specify State Space models with a maximum of flexibility and a minimum of coding and with a lot of coding from the side of the developers that makes life much easier to the users. The tutorial is here.

M4 Conference

I just have been to this remarkable conference, that is a sort of spin-off of the M4 competition. It has been really nice, mainly because of the people involved and the high level of the talks. We had the chance to see how people from industry (big ones, actually, Amazon, Google, Microsoft, Uber and SAS) deal with the problem of forecasting in different contexts, as well as notorious academics.
The winners of the competition explained their methods and people from this big companies explained how their day-by-day forecasting problems look like. It was interesting to see how some of the presenters spoke of statistical or classical methods as opposed to Machine Learning or AI methods. The organizers did a great work in making the competition as transparent as possible and actually the results of all methods finally submitted may be replicated with the software provided by the contestants, making replicability straight away. The winners were a mixture of mature and quite young people, and statistical and «new» methods. The results were then well balanced and mark the way to go if we like to improve our forecasting abilities.
The environment was very cooperative and I had the chance to see quite open minded people in both sides of the academic and industry. A big pleasure!!

SSpace published in the Journal of Statistical Software

SSpace is a MATLAB toolbox for time series modeling and forecasting in a rather flexible and powerful State Space framework. It may be downloaded from Bitbucket, but the news is that it is now published in the Journal of Statistical Software (here).

There is a lot to do still, but any potential user that gives it a try would soon realize that it is very easy to use. I would recommend running the demos from beginning to end, since they are conceived as a tutorial that drives the user through the modeling process step by step. People who are not directly interested in State Space modeling may also take advantage of the toolbox, because there are several templates for implementing many sort of usual time series models in a very flexible way. In other words, there is no need to know anything about State Space approaches to exploit fully the toolbox.

There are still more toolboxes to come soon!!