Geospatial · Areas and surfaces
Calibrate Gravity Model
Fits the Gravity Model's attractiveness and distance-decay settings to what customers actually did, such as loyalty-card visits per area and store, and reports how well the fit reproduces each store.
Also known as: Calibrate Huff, distance decay
How it works
Wire three tables: demand (origins), locations, and observed data with one row per origin and location, or raw transactions, holding visits, customers or spend. Pick the Observed origin id column, Observed location id column and Observed value column, then the same geometry, id, Demand and Attractiveness columns, Distance measure, Distance decay and Search limit you use on the Gravity Model being calibrated. Fit chooses Both exponents (α and β), the default, or Distance decay only (β) with a Fixed attractiveness exponent (α), 1 by default.
The exponents are fitted by maximum likelihood. With Output set to Parameters the result is one row: alpha, beta, decay, distance_measure, search_limit, r_squared, mape, pairs_used, origins_used and locations_used. Fit by location instead adds observed, predicted, error, error_pct and captured_demand to each location so you can see which stores the fit reproduces well.
Inputs and outputs
Inputs
demand— Tablelocations— Tableobserved— Table
Outputs
data— Table
Settings
The Attributes panel of Calibrate Gravity Model, as in the app: the controls work, but nothing runs — there is no data behind it.
The same settings, as the Assistant writes them
{
originGeometryColumn: string
originIdColumn: string
demandColumn?: string
locationGeometryColumn: string
locationIdColumn: string
attractivenessColumn?: string
observedOriginColumn: string
observedLocationColumn: string
observedValueColumn: string
distanceMeasure: "straight"|"drive-time"|"drive-distance"
decay: "power"|"exponential"
searchLimit: number
fit: "both"|"decay-only"
fixedAlpha: number
output: "parameters"|"locations"
}inputs: demand (origins), locations (stores), observed (one row per origin x location — or raw transactions — with visits/customers/spend). Fits alpha and beta of a Gravity Model by maximum likelihood. output "parameters" (default) is one row: alpha, beta, decay, distance_measure, search_limit, r_squared, mape, pairs_used, origins_used, locations_used; "locations" appends observed, predicted, error, error_pct, captured_demand to each location. Use the same columns and distance settings as the Gravity Model it calibrates. Never emit tile-set ids or paths.
Example
You have loyalty-card visits per postcode and store. Wire the postcode table, the store table and the visits table, pick the id and value columns, keep Fit at Both exponents and Output at Parameters, then wire the result into the Gravity Model's params input so its forecast uses the alpha and beta fitted from your own data.