Predictions

Part of the Municipalities lab

A regression learns the relationship between the demographic indicators and the average income of the region's municipalities, then **estimates** it for each one: where the estimate misses the most, something the demographic data alone can't explain is going on. The **R²** in the status tells you how much of the income the model explains.

▶ Use this app

data space «laboratorio-comuni» — this micro app reads and writes the suite’s shared data space.

The other micro apps in the same suite

How it works

This is a Reactive app: a plain text document that your browser turns into a working app — forms, live data, tables, statistics and even charts, with nothing to install or configure.

  1. Use it right away. Hit “Use this app”: it opens right in your browser, ready to go, with data saved only on your device.
  2. Your data stays yours. Everything is stored locally on your device, kept separate for each app: no account, no server, nothing to set up.
  3. Make it your own. The text below is the entire app: copy it, tweak fields, views and words, and your changes become interactive instantly.
  4. Share it as a file. An app is a simple file: save it, export it or share it with a link; and with encrypted collaboration several people edit the same data in real time.
The app’s source
# 🎯 Predictions

## How much income do age and foreigners "explain"?

A regression learns the relationship between the demographic indicators and
the average income of the region's municipalities, then **estimates** it for
each one: where the estimate misses the most, something the demographic data
alone can't explain is going on. The **R²** in the status tells you how much
of the income the model explains.

::ml-predict{data="comuni" features="eta,stranieri" target="reddito" model="forest" into="stime"}

Each point is a municipality: the horizontal axis is the **real** income, the
vertical one the model's **estimate**. The closer the points sit to the
diagonal, the better the model explains.

::chart-scatter{data="stime" x="reddito" y="previsione" height="20rem"}

:::table{path="stime" headers="Municipality,Real income €,Model estimate €" pagesize="8"}
{comune} | {reddito} | {previsione}
:::