SERVICE

Forecasting, models and optimisation in R

I use data science where it brings a measurable benefit: forecasting demand and sales, grouping customers, checking what really drives results and optimising decisions such as order quantities. I always compare the model with the simple method you use today.

You work directly with me · Warsaw, Poland · working remotely across the EU
Tools: R, Excel, SQL

What you get

  • A forecast or model with uncertainty ranges
  • A report with interpretation, method comparison and limitations
  • Commented R code you can run again
  • Results in Excel for further work
Typical turnaround
1⁠–⁠3 weeks
Quote
free, no obligation
Payment
after acceptance on a first order

When I can help

  • You plan purchasing and production based on last year’s figures.
  • You have too much of some products and run out of others at the worst moment.
  • You want to know which factors really drive sales or customer churn.
  • You have a customer base and want to split it into groups that behave alike.
  • You need to allocate a limited budget or resources and want the best option.

What you gain

  • Decisions based on numbers, with uncertainty clearly stated.
  • A model tested on data it hasn’t seen — you know what to expect from it.
  • A comparison with your current method, so you see the real gain.
  • Code you can run again on new data.

What I do

  1. We agree which decision the model should support and how it will be used.
  2. I prepare the data and check whether it’s enough for a reliable result.
  3. I compare several methods with a simple baseline, such as “same as last year”.
  4. I measure accuracy on hold-out data the model hasn’t seen.
  5. For optimisation I model costs and constraints and check the result in a simulation.
  6. I document the assumptions, the limitations and when the model needs updating.

How I approach it

I don’t start with machine learning; I start by asking whether a simple method would do. If a model isn’t clearly better than what you use today, I say so and don’t sell complexity for its own sake. I explain benefits, assumptions and limitations in business terms rather than jargon, so the result can be defended in front of management. The demo examples show both: a demand forecast and order optimisation, each compared with a baseline.

EXAMPLES

Examples on fictional data

Client data is confidential, so I show the same kind of work on fictional data. The results are calculated from that data — these are not client projects.

Forecasting · RDemo
1,2501,7502,2502,750forecastNov 24: 1,702 unitsDec 24: 1,492 unitsJan 25: 1,547 unitsFeb 25: 1,388 unitsMar 25: 2,106 unitsApr 25: 2,155 unitsMay 25: 2,056 unitsJun 25: 2,293 unitsJul 25: 2,171 unitsAug 25: 2,000 unitsSep 25: 2,234 unitsOct 25: 2,035 unitsNov 25: 1,979 unitsDec 25: 1,759 unitsJan 26: 1,970 unitsFeb 26: 1,988 unitsMar 26: 2,315 unitsApr 26: 2,272 unitsMay 26: 2,518 unitsJun 26: 2,414 unitsJul 26: 2,663 unitsAug 26: 2,484 unitsSep 26: 2,515 unitsOct 26: 2,510 unitsNov 26 (forecast): 2,051 units, range 1,898–2,205Dec 26 (forecast): 1,836 units, range 1,700–1,973Jan 27 (forecast): 2,071 units, range 1,919–2,224Feb 27 (forecast): 2,105 units, range 1,951–2,259Mar 27 (forecast): 2,468 units, range 2,288–2,647Apr 27 (forecast): 2,438 units, range 2,262–2,614Nov 24May 25Aug 25Nov 25Feb 26May 26Aug 26Nov 26Apr 27
Chart data
MonthSales, unitsForecast, units80% interval
Nov 241,702
Dec 241,492
Jan 251,547
Feb 251,388
Mar 252,106
Apr 252,155
May 252,056
Jun 252,293
Jul 252,171
Aug 252,000
Sep 252,234
Oct 252,035
Nov 251,979
Dec 251,759
Jan 261,970
Feb 261,988
Mar 262,315
Apr 262,272
May 262,518
Jun 262,414
Jul 262,663
Aug 262,484
Sep 262,515
Oct 262,510
Nov 262,0511,898⁠–⁠2,205
Dec 261,8361,700⁠–⁠1,973
Jan 272,0711,919⁠–⁠2,224
Feb 272,1051,951⁠–⁠2,259
Mar 272,4682,288⁠–⁠2,647
Apr 272,4382,262⁠–⁠2,614
1,2501,7502,2502,750forecastNov 24: 1,702 unitsDec 24: 1,492 unitsJan 25: 1,547 unitsFeb 25: 1,388 unitsMar 25: 2,106 unitsApr 25: 2,155 unitsMay 25: 2,056 unitsJun 25: 2,293 unitsJul 25: 2,171 unitsAug 25: 2,000 unitsSep 25: 2,234 unitsOct 25: 2,035 unitsNov 25: 1,979 unitsDec 25: 1,759 unitsJan 26: 1,970 unitsFeb 26: 1,988 unitsMar 26: 2,315 unitsApr 26: 2,272 unitsMay 26: 2,518 unitsJun 26: 2,414 unitsJul 26: 2,663 unitsAug 26: 2,484 unitsSep 26: 2,515 unitsOct 26: 2,510 unitsNov 26 (forecast): 2,051 units, range 1,898–2,205Dec 26 (forecast): 1,836 units, range 1,700–1,973Jan 27 (forecast): 2,071 units, range 1,919–2,224Feb 27 (forecast): 2,105 units, range 1,951–2,259Mar 27 (forecast): 2,468 units, range 2,288–2,647Apr 27 (forecast): 2,438 units, range 2,262–2,614Nov 24Nov 25May 26Apr 27
Chart data
MonthSales, unitsForecast, units80% interval
Nov 241,702
Dec 241,492
Jan 251,547
Feb 251,388
Mar 252,106
Apr 252,155
May 252,056
Jun 252,293
Jul 252,171
Aug 252,000
Sep 252,234
Oct 252,035
Nov 251,979
Dec 251,759
Jan 261,970
Feb 261,988
Mar 262,315
Apr 262,272
May 262,518
Jun 262,414
Jul 262,663
Aug 262,484
Sep 262,515
Oct 262,510
Nov 262,0511,898⁠–⁠2,205
Dec 261,8361,700⁠–⁠1,973
Jan 272,0711,919⁠–⁠2,224
Feb 272,1051,951⁠–⁠2,259
Mar 272,4682,288⁠–⁠2,647
Apr 272,4382,262⁠–⁠2,614

Six-month demand forecast

Problem
Purchasing planned on the same month’s sales a year earlier.
Data
24 months of unit sales (Nov 2024 – Oct 2026) with clear seasonality and an upward trend.
Work
Exponential smoothing with a damped trend on seasonally adjusted data. Tested on the last 6 months, which the model didn’t see, and compared with “same as last year”.
Result
Mean forecast error (MAPE) on test data: 9.2%, versus 15.2% for “same as last year”. A forecast to April 2027 with an 80% range — the upper bound suggests the safety stock.
Tools
R
Optimisation · RDemo
“Same as last month”€46.2k“Same as last month”: holding €16.9k, shortages €29.3k (1,798 units short), total €46.2kOptimised model€35.3kOptimised model: holding €19.2k, shortages €16.1k (905 units short), total €35.3k

Total cost over the test year (52 weeks, 24 products), € thousand

Chart data
PolicyHoldingShortagesUnits shortFill rateTotal
“Same as last month”€16.9k€29.3k1,79895.6%€46.2k
Optimised model€19.2k€16.1k90597.8%€35.3k
“Same as last month”€46.2k“Same as last month”: holding €16.9k, shortages €29.3k (1,798 units short), total €46.2kOptimised model€35.3kOptimised model: holding €19.2k, shortages €16.1k (905 units short), total €35.3k

Total cost over the test year (52 weeks, 24 products), € thousand

Chart data
PolicyHoldingShortagesUnits shortFill rateTotal
“Same as last month”€16.9k€29.3k1,79895.6%€46.2k
Optimised model€19.2k€16.1k90597.8%€35.3k

Order quantity optimisation

Problem
Orders placed “same as last month”: too much of some products, stock-outs of others.
Data
24 products, one year of weekly demand for calibration and one for testing, lead times of 1⁠–⁠3 weeks, holding and shortage costs.
Work
For each product I set a reorder-up-to level that minimises total cost in a simulation on year one. I tested it on year two and compared it with the rule “order what sold last month”.
Result
In the test year total cost was 23.5% lower: units short fell from 1,798 to 905, at the price of slightly higher stock (holding cost +14%).
Tools
R, Excel

Sample input files: product parameters (CSV)

What I need for a quote

  • The purpose of the model and the decision it should support
  • The period and frequency of the historical data (e.g. 3 years of monthly data)
  • A description of the variables and known events (promotions, price changes, gaps)
  • The forecast horizon or the constraints to take into account

Questions

Is the forecast guaranteed to be accurate?

No. Forecast quality depends on the data, the assumptions and how volatile the process is. That’s why every model is tested on data it wasn’t fitted to, and the result comes with an uncertainty range.

How much data does a forecast need?

For monthly data with seasonality, usually at least two full years. Shorter histories can work too, but the uncertainty is higher — the report says so.

Do I need to know R to use the results?

No. You get the results in Excel and in the report. The R code is there so the calculations can be repeated — I can do the updates for you.

What happens after the 30 days of support?

After the 30 days I quote small fixes separately, always before starting, or we agree ongoing support. The documentation also lets someone else take the solution over.

How do we work together, and how does billing work?

You describe the problem in a few sentences. Within 1 business day I reply with questions or a proposal, then send a free quote with the scope, timeline and price. I bill through Useme, a Polish freelance platform: you get a VAT invoice, and your payment can be held by Useme until you accept the work. An NDA is available on request.

CONTACT

Tell me what you need.

A few sentences are enough. I’ll reply within 1 business day with questions or a proposed scope, timeline and price.

  • No files and no tool names needed at this stage.
  • Scope, timeline and price are agreed before I start.

Prefer to email? [email protected]

ENQUIRY FORM

Request a free quote

Please don’t include confidential data at this stage. The quote is free and there’s no obligation.

Your details are used only to reply to your enquiry and prepare a quote. The data controller is Hubert Salwa. Details: privacy policy.

DEMO · FICTIONAL DATA

Demo

Describe your problem