Home / Digital business and AI / Module 5
Predictive analytics uses your past data to estimate what is likely to happen: how much you will sell, which customers will leave, how much to buy. You will see how to start simple, measure the error and decide with a range.
Goal: Tell apart the four types of analytics, calculate a forecast with a moving average and its error in a backtest, and decide how many units to order with a range.
Predictive analytics uses past data to estimate what is likely to happen. It does not guess: it finds patterns, such as monthly purchases or repurchase habits, and projects them forward. It is one step on a ladder. Descriptive analytics tells you what happened, diagnostic analytics explains why, predictive analytics estimates what will happen and prescriptive analytics suggests what to do. A small business gains a lot from the first two before jumping to the third.
In a digital business it helps with four decisions. Demand: how many units to buy before a campaign. Repurchase: which customers are about to stop buying and deserve a message. Customer value: how much a customer is expected to spend over time, to decide how much to pay to acquire them. Advertising and prices: which products or audiences perform best. Pick a decision you make by eye today and that costs money when it goes wrong, such as overbuying or running out of stock.
AI helps in two ways. Machine learning models learn from your data and already come built into many store and advertising platforms. General-purpose AI assistants can read a table, calculate a forecast and explain the method. With either one, start simple: a moving average (the average of the last few months) with a seasonal adjustment is often enough. A complex model with little data looks precise and fails. Ask the assistant to show the formula and check the math yourself.
Data rules. You need at least 12 months of sales by product and by month; with 24 you can see the seasons better, such as Mother's Day or Christmas. Remove duplicates and flag months with promotions or with no stock, because sales lost to stockouts do not show up in your figures. Before using a forecast, run a backtest: predict months that already happened, without looking at them, and compare with the actual figures. The mean absolute percentage error (MAPE) is the average of how far off you were each month, as a percentage.
A forecast is a range, not an exact figure, and it breaks when something changes suddenly. Decide with the range, leave a safety margin and review it every month. If you use customer data, do so with their consent and following the rules of Law No. 29733, the Personal Data Protection Law. Also take care with cases where the model decides about a person, such as whether to grant a loan: Peru's AI regulation calls for more transparency and human review. Large-scale demand planning is covered in the area on Supply Chain, Technology and AI (scm).
| Type of analytics | Question it answers | Example in your store |
|---|---|---|
| Descriptive | What happened? | In October you sold 170 units |
| Diagnostic | Why did it happen? | Sales rose because of an email campaign |
| Predictive | What is likely to happen? | November will be around 196 units |
| Prescriptive | What should I do? | Order 174 units from the supplier |
Result: The November forecast is 196 units, with a range of 183 to 209 based on a mean error of 6.5%. To cover the high end with 35 units in stock, Café Altura orders 174 and accepts a possible surplus of 13 units.
09/09/2025
On 09/09/2025, Supreme Decree No. 115-2025-PCM was published in El Peruano. It sets the regulations for Law No. 31814 on the use of artificial intelligence. It distinguishes prohibited, high-risk and acceptable-risk uses. Among the high-risk uses it cites systems that determine credit assessment (except fraud detection) and those used to hire or dismiss workers. For them it calls for transparency and human oversight, and it sets adaptation periods of one to four years depending on sector and size.
Use predictions for stock and campaigns, but if a model decides about a person, such as a loan or a job, check whether it is high risk and keep an explanation and human review.
Source: Congreso de la República – Decreto Supremo N.° 115-2025-PCM, Reglamento de la Ley N.° 31814
2022
In its letter to shareholders on fiscal year 2021, Amazon acknowledges that it did not know what to expect in 2021 and that pandemic growth amounted to what it had forecast for three years, happening in about 15 months. To meet that demand it had to double its fulfillment network in 24 months. It also expected the impact of COVID-19 to ease by the end of 2021, but then came the Omicron variant and, later, rising costs from the war in Ukraine. Not even a company with enormous volumes of data anticipated the change.
Treat the forecast as a range, review it every month and keep flexible capacity, for example orders in batches or a logistics operator that can absorb peaks.
Practise with the calculators, the COMEX Simulator and the review questions on the main page.
Open this topic in the calculator →