# Motor Vehicle Retail Sales

## Problem description¶

A common task in retail is to forecast demand (sales) couple of months, even years ahead. Without proper forecast, it can be really difficult to have the right amount of stock on hand at any given time and vice versa, too much merchandise in the warehouse means more capital tied up in inventory. This might push customers to seek merchandise elsewhere. We will take motor vehicle industry as an example. We will try to forecast aggregated demand for all passenger cars, including station wagons for one year ahead.

## Data Recommendation Template¶

Out dataset is gathered monthly and contains domestic U.S. sales of vehicles assembled in the U.S., Canada, and Mexico. We will use all samples gathered from the beginning of the year 1967 until the August of 2019. More data can be downloaded here. For the sake of simplicity, the data is univariate and not enhanced with any additional predictors. But if you look closely, you can see that economic recessions had a huge impact on the demand. Therefore it is reasonable to expect that combining this dataset with interesting economic indicators could enhance the accuracy significantly.

## TIM Setup¶

TIM requires no setup of TIMs mathematical internals and works well in business user mode. All that is required from a user is to let TIM know a forecasting routine and desired prediction horizon.

## Demo example¶

### Target¶

Aggregated demand of motor vehicles labeled DAUTONSA.

### Predictor candidates¶

No predictors included.

### Timestamp¶

Timestamp is the first column and each value of the timestamp is the period it corresponds to i.e. ‘DAUTONSA’ in the row with timestamp 2011-01 corresponds to the whole demand during period between 2011-01-01 and 2011-01-31.

### Forecasting scenario¶

In this example we will simulate a year ahead scenario (12 samples - 12 months). Each month we wish to have forecasts for 12 months ahead starting from the next month. We will suppose that the demand of the preceding month is already known.

### Model building and validation¶

Model is built using a range between 1967-01 and 2016-12. Out-of-sample forecasts are made on the rest - from 2017-01 to 2019-08. The proper way of emulating the real accuracy of TIM when used month by month would be to create more configuration files, where the training period would be rolling as the economy might change a lot in one month. But for the simplicity, we will keep the building period static.

### Demonstration¶

#### TIM Connector¶

##### 2. Create folder with dataset¶

Create folder e.g. retail with dataset file [DAUTONSA.csv] and configuration file [conf.yaml]. retail/ DAUTONSA.csv conf.yaml YAML config defines forecasting scenario described above.

Model building: Model building is in range from 1967-01-01 and 2016-12-01. Target named DAUTONSA is updated every month up until the preceding one. Configuration: Model is used repeatedly each month. Forecasts are made for the following year (12 months).

Forecasting: Out-of-sample forecasts are to be done in a period from 2017-01-01 to 2019-07-01.

version: "1.0"
type: Forecasting
modelBuilding:
data:
rows:
- from: 1967-01
to: 2016-12
configuration:
usage:
usageTime:
- type: Day
value: "*"
usageType: Repeating
predictionFrom:
baseUnit: Sample
offset: 1
predictionTo:
baseUnit: Sample
offset: 12
forecasting:
configuration:
predictionScope:
type: Ranges
ranges:
- from: 2017-01
to: 2019-08

##### 3. Call connector from the command line (terminal)¶

First, change the directory to TIM Connector's builddir with the command: > cd pathToConnector\builddir. Then, call the connector with the following command: > pathToConnector\timconnect.exe path\to\retail\conf.yaml`.

##### 4. Fill in user credentials¶

Following the previous command, the user will be prompted to fill in their user credentials. Fill in the correct information and click "OK" to continue.

Output in console: