run la-retta-dei-cinque-negozi.bas
MDN-120:19
DEMO by Michele di Nuzzo

The line of the five stores

MDN · LAB THE LINE OF THE FIVE STORES regression and error · 1805
b (punto di partenza)
starting point: raises or lowers the line
w (euro per m², in migliaia)
euros per m², in thousands: changes the slope of the line
aggiungi Lecce (263 m²)
add Lecce: the sixth store, the one that doesn’t fit
mostra i quadrati degli errori
show the squares of the errors: draws the square of each error
la media: 898,8
the mean: the flat line, w = 0
300 + 2,2 · x / 250 + 2,5 · x
the two rules to compare
la retta dei minimi quadrati
the least-squares line: sets b and w to it

▶ Run ⬇ Download (.html)

Five Ordito stores already open, their floor area and their 2025 revenue: the rule is a straight line, predicted revenue = b + w · area. Move b and w and watch the errors store by store, on the chart and in the bars, with the MAE and the RMSE summing them up: each pair of numbers is a different model. The lab’s interface is in Italian.

Things to try

  • The mean. With w = 0 the line is flat: it is the benchmark that every model has to beat.
  • Two rules compared. 300 + 2.2 · x and 250 + 2.5 · x: two similar lines, two different errors; switch on “mostra i quadrati degli errori”.
  • The store that doesn’t fit. Add Lecce: any reasonable line overestimates it, because something is missing from the data.

The article: The line of the five stores.

The demo is a single HTML file: download it and use it offline, even without an internet connection. Licence: CC BY-NC 4.0 — you may share it, crediting the author and this page, but not for commercial purposes.