Gravity Model Calculator

Model flows between places using masses and distance. Tune exponents, constants, and decay settings easily. Download results, compare scenarios, and understand sensitivities clearly fast.

Calculator

Batch accepts rows: M1,M2,D
Choose how distance reduces interaction.
Controls displayed rounding only.
Overall level of interaction.
Elasticity of flow with respect to M1.
Elasticity of flow with respect to M2.
Higher γ means stronger distance penalty.
Higher λ means faster decay with distance.
Uses (D+ε) to avoid zero distance issues.
Displayed value = T / scale (e.g., 1000).
Example: population, size, or weight.
Second location’s mass measure.
Any consistent distance unit.
Separators: comma, semicolon, or tab. Headers are ignored.

Formula Used

The gravity model estimates interaction between two locations using mass terms and a distance penalty. Choose a distance impedance that fits your use case.

Power decay
T = K · (M1α) · (M2β) / ( (D+ε)γ )
Elasticity with respect to distance is approximately −γ in log-log form.
Exponential decay
T = K · (M1α) · (M2β) · exp( −λ · (D+ε) )
Distance elasticity varies with D and equals −λ(D+ε).

Notes: M1 and M2 can represent population, economic size, demand, or any comparable scale. Use consistent distance units and keep K aligned with your chosen units.

How to Use This Calculator

  1. Pick Single for one pair, or Batch for many rows.
  2. Select a distance impedance: Power or Exponential.
  3. Set K, α, β, and γ or λ.
  4. Enter M1, M2, and D (or paste batch rows).
  5. Press Calculate to view results above the form.
  6. Use Download CSV or Download PDF for reporting.

Example Data Table

Sample inputs below use default parameters (K=1, α=1, β=1, γ=2). Values illustrate how distance reduces interaction.

Case M1 M2 D Expected Trend
A 1,000,000 750,000 250 Baseline interaction at moderate distance
B 1,200,000 600,000 180 Higher M1 and shorter distance increase flow
C 900,000 900,000 320 Larger distance reduces flow despite strong masses

What the Gravity Model Represents

The gravity model estimates interaction between two places as a function of “mass” and separation. In practice, mass can be population, GDP, jobs, student enrollment, or store demand. If M1 doubles while other terms stay fixed and α=1, predicted flow doubles. If α=0.7, doubling M1 increases flow by about 62%.

Choosing Power or Exponential Decay

Distance impedance is the main behavioral choice. A power decay divides by (D+ε)^γ and is common when long-range links still matter. Typical γ values range from 1.0 to 3.5. An exponential decay multiplies by exp(−λ(D+ε)), producing faster drop‑off; λ often sits between 0.01 and 0.20 per distance unit.

Interpreting Parameters and Elasticities

K sets the baseline level of interaction after unit choices. α and β are constant elasticities with respect to M1 and M2, so they are directly comparable across scenarios. Under power decay, distance elasticity is −γ, meaning γ=2 implies a 1% distance increase reduces flow by roughly 2%. Under exponential decay, elasticity equals −λ(D+ε), so effects strengthen as distance grows.

Scenario Analysis with Scaling and Offsets

The scale factor reports T/scale, which is convenient for “per 1,000 trips” or “per million dollars.” Use ε when D can be near zero or when minimum travel friction exists; ε=5 can represent local access costs. Compare two scenarios by holding masses fixed and varying γ or λ; a small change from γ=1.8 to 2.0 can materially reduce long-distance predictions.

Batch Estimation for Multiple Pairs

Batch mode processes many rows of (M1,M2,D) and outputs Flow, Scaled Flow, and ln(Flow). The log value is useful for regression workflows because ln(T)=ln(K)+αln(M1)+βln(M2)−γln(D+ε) under power decay. For stable estimates, include wide ranges of masses and distances, and avoid rows with zero masses.

Practical Benchmarks and Quality Checks

Start with realistic units: kilometers with λ near 0.02–0.08 often yields moderate decay, while miles may need different λ. Validate against observed flows by checking median absolute percentage error and outliers. If the model overpredicts nearby flows, increase ε or reduce K. If it underpredicts long trips, lower γ or λ and reassess. Document assumptions, then rerun the graph to confirm sensitivity before publishing final scenario outputs.

FAQs

1) What should I use for M1 and M2?

Use any comparable size measures: population, GDP, jobs, demand, or capacity. Keep units consistent across rows so changes in α and β reflect real sensitivity, not unit shifts.

2) When is power decay better than exponential decay?

Power decay fits situations where long-distance interactions still occur, because the tail decreases gradually. Exponential decay fits settings with strong friction, where flows drop rapidly as distance rises.

3) How do I interpret α and β?

They are elasticities. If α=0.8, a 10% increase in M1 raises predicted flow by about 8%, holding other inputs fixed. The same interpretation applies to β and M2.

4) Why add a distance offset ε?

ε prevents unstable results when D is near zero and can represent fixed local friction, like access time. It shifts all distances to D+ε, making short-distance predictions less extreme.

5) What does the scale factor change?

It does not change the underlying T; it changes how results are reported. For example, scale=1000 reports “thousands of units,” making values easier to read and compare.

6) How can I validate the model?

Compare predicted flows to observed data. Check median absolute percentage error, inspect outliers, and adjust K and decay parameters. Use batch mode to test many pairs and verify distance patterns visually.

Related Calculators

linear model calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.