🌾 Does Better Data Make Better Markets?

Simulating agricultural contract markets with agent-based modeling to test whether precision agriculture data changes price formation, wealth distribution, and market efficiency.

By rdjarbeng Β· April 2026 Β· Interactive Demo Β· Source Code

πŸ“‘ Contents

  1. The Question
  2. The Model: How It Works
  3. Information Tiers: The Controlled Variable
  4. The Mathematics Under the Hood
  5. Agent Types and Strategies
  6. Results: What We Found
  7. Seeing Causation: The Step-Through Playback
  8. Implications for Precision Agriculture
  9. Try It Yourself
  10. What's Next

1. The Question

Agricultural markets have always operated under uncertainty. A farmer planting tomatoes in March doesn't know what the weather will be in July, what diseases might strike, or what the spot price will be at harvest. An investor prepaying for a share of that harvest faces the same fog β€” plus not knowing what other investors are doing.

Precision agriculture technologies β€” soil sensors, satellite imagery, drone-based crop monitoring β€” are generating unprecedented data about what's actually happening on farms. The question is:

Does access to better data fundamentally change how agricultural markets behave? Does it make prices more stable? Does it distribute wealth more equally? Or does it create new problems β€” more competition, compressed margins, herding behavior?

We built an agent-based simulation to find out. The answer turns out to be surprising: knowing what the market thinks matters more than knowing what the crops are doing.

2. The Model: How It Works

The simulation models a market where investors prepay for fractions of a farm's future produce β€” like agricultural futures, or community-supported agriculture (CSA) shares:

MARKET STRUCTURE Farmers own plots planted with crops (tomato, cocoa, maize, wheat, coffee) └── Offer plots as contracts via sealed-bid auctions Investors evaluate contracts and bid on them └── 5 strategies: speculator, conservative, momentum, contrarian, value Banks provide loans to both sides └── 3 behaviors: conservative, moderate, aggressive Factories (planned) buy harvested produce at fair market price └── Ketchup factory for tomatoes, chocolate factory for cocoa, etc. TIMELINE (1 step = 1 week) Week 1-26: PRIMARY MARKET β€” farmer lists plots, investors bid Week 20+: BANK PHASE β€” processing delay when utilization hits 80% Week 26+: SECONDARY MARKET β€” investors flip contracts to each other Week 27-30: HARVEST β€” payouts based on actual yield Γ— spot price Week 31+: OFFSEASON β€” reset for next season

One simulation step equals one week. A typical run covers 2 growing seasons (65+ weeks). Weather drives crop growth, crop growth drives expected yields, yields drive contract valuations, valuations drive bidding, bidding drives prices. Everything is connected.

5
Crop Types
3
Livestock Types
5
Investor Strategies
5
Information Tiers

3. Information Tiers: The Controlled Variable

The central experiment varies how much information agents have:

TierWhat the Agent KnowsReal-World Analogue
πŸ”‡ BlindOnly the current ask priceFarmer's market β€” you see the price tag, nothing else
πŸ“ LocalOwn past trade pricesExperienced buyer who remembers what they paid before
πŸ“Š MarketRolling-average public price indexCommodity exchange with published market data
πŸ” FullMarket index + competitor countTrading floor where you can see other bidders
πŸ›°οΈ PrecisionFull + real-time crop growth, disease, irrigation dataPrecision ag: sensors, drones, satellite imagery

4. The Mathematics Under the Hood

Crop Growth β€” GDD-Based Logistic Model

Biomass follows a logistic curve driven by Growing Degree Days:

B(t) = B_max / (1 + exp(-k Γ— (GDD(t) - GDD_mid)))

Where:
  GDD accumulates weekly as max(0, T_avg - T_base) Γ— 7
  Yield = Biomass Γ— Harvest_Index Γ— Stress_Multiplier
  Stress = (1-water_stressΓ—0.6) Γ— (1-temp_stressΓ—0.5) Γ— (1-diseaseΓ—0.4)

Weather β€” Seasonal Stochastic Process

T(week) = T_mean + T_amp Γ— sin(2Ο€(week - Ο†)/52) + N(0, Οƒ)
Rain ~ Gamma(shape, scale Γ— seasonal_factor)
Climate modes: normal, El NiΓ±o (+1.5Β°C, -30% rain), La NiΓ±a (-1Β°C, +30% rain)

Spot Prices β€” Ornstein-Uhlenbeck

dP = ΞΈ(ΞΌ - P)dt + ΟƒdW    (mean-reverting commodity prices)

Livestock β€” Gompertz Growth

W(t) = W_max Γ— exp(-b Γ— exp(-c Γ— t))    (asymptotic weight gain)
CropBase TempGDD to MaturityMax YieldPrice
πŸ… Tomato10Β°C1,20036 t/ha$800/t
🌽 Maize10°C1,40012.5 t/ha$250/t
🫘 Cocoa15°C2,4001.2 t/ha$3,200/t
🌾 Wheat4°C1,8006.8 t/ha$300/t
β˜• Coffee14Β°C2,2001.25 t/ha$4,500/t

5. Agent Types and Strategies

Investor Strategies

Bank Lending Behaviors

BehaviorMax LTVApproval ThresholdRate Premium
Conservative50%High (0.6)-1% (lower rates)
Moderate70%Medium (0.4)0% (baseline)
Aggressive90%Low (0.2)+2% (higher rates)

Banks evaluate loans using a credit score derived from the borrower's capital, utilization rate, and repayment history. They also adjust rates based on what competing banks are offering.

6. Results: What We Found

We ran 50 Monte Carlo simulations per information tier, holding all other parameters constant. Here are the key findings:

Finding #1: Market-level information has the strongest impact on fairness. The Gini coefficient (holdings concentration) dropped from 0.81 (blind) to 0.73 (market) β€” a large effect (Cohen's d = -1.10). Giving everyone access to a public price index distributes holdings more equitably.
Finding #2: Personal price anchoring is harmful. The "local" tier β€” where agents anchor to their own past trade prices β€” produced the most volatile markets (Οƒ doubled from $972 to $2,386, d = +0.94) and the worst investor returns (d = -1.08). Anchoring creates divergent beliefs and a winner's curse spiral.
Finding #3: Precision agriculture data has smaller aggregate effects than expected. Farm-level telemetry (growth %, disease severity, irrigation status) helps individual decisions but doesn't change market-level dynamics as much as simply publishing an average price index. Cohen's d for Gini was only -0.36 vs -1.10 for the market tier.

The Information Hierarchy

Our results suggest a clear hierarchy of information value:

Market consensus (public price index)
  > Competitor awareness (who else is bidding)
    > Farm-level telemetry (precision ag data)
      > Personal history (can be harmful!)

Key Metrics by Tier

MetricBlindMarketFullPrecision
Gini (holdings)0.810.730.750.78
Contested trades8.419.817.412.9
Price volatility ($)9721,4591,1141,639
Investor ROI0.0%-0.0%-1.0%0.0%

7. Seeing Causation: The Step-Through Playback

The simulation features an interactive step-through mode where you can scrub through every week and observe the causal chain:

CAUSAL CHAIN (each week) Weather 🌑️ 28.3Β°C | 🌧️ 42mm | πŸ’§ 78% ↓ Crops Avg growth 67% | Soil moisture 0.28 | Disease 3% ↓ Banks Loan $15,000 to farmer @ 7.2% (farmer capital was low) ↓ Trades Inv 104 bought plot 7 (tomato) for $523 [12 bidders] ↓ Price Index: $498 (rolling 10-trade average)

You can use the β—€ Back and Fwd β–Ά buttons, or drag the week slider, to move through time and watch how:

Every simulation is reproducible. Set the same random seed and parameters, and you'll get identical results week by week. Change the seed to see how different weather sequences produce different market outcomes.

8. Implications for Precision Agriculture

For Market Design

If the goal is market fairness and efficiency, investing in public market transparency infrastructure (real-time price indices, open contract databases) may be more impactful than subsidizing private farm-level monitoring technology. A simple published average price does more for Gini reduction than sophisticated crop sensors.

For Platform Design

Market platforms should prominently display public price indices rather than letting participants' interfaces show only their personal transaction history. The "local" tier's poor performance shows that personal anchoring actively harms market efficiency.

For Investors

More information doesn't necessarily mean more profit. The "full" information tier (market + competitors) produced the most competitive environment and the lowest individual returns. Information is an arms race β€” when everyone has it, the edge disappears.

For Farmers

When markets are more transparent (market/full tiers), contract prices are more competitive β€” good for farmers who receive higher bids. But it also means more investors participating, which can create auction pressure and volatile bidding patterns.

9. Try It Yourself

The full simulation is available as an interactive Streamlit app:

Three Modes

  1. Single Run (Step-Through) β€” Run a simulation, then scrub through every week. See the causal chain, watch crops grow, track money flow, inspect every trade.
  2. Monte Carlo Experiment β€” Run 50+ simulations per information tier. Compare box plots, effect sizes (Cohen's d), strategy Γ— tier interactions. Export as CSV.
  3. Crop Growth Explorer β€” Adjust temperature, rainfall, and irrigation interactively. See how each crop responds. Compare all crops under the same conditions.

Quick Start

# Clone and run locally
git clone https://huggingface.co/spaces/rdjarbeng/agrimarket-abm
cd agrimarket-abm
pip install mesa networkx pandas numpy streamlit plotly scipy
streamlit run app.py

Run Monte Carlo from Python

from metrics import run_monte_carlo, compute_effect_sizes

df = run_monte_carlo(
    info_levels=("blind", "local", "market", "full", "precision"),
    n_runs=50,
    num_investors=20,
    num_farmers=2,
    num_banks=2,
    season_length_weeks=30,
    num_seasons=2,
)

effects = compute_effect_sizes(df, baseline_tier="blind")
for tier, metrics in effects.items():
    sig = [m for m, d in metrics.items() if d["significant"]]
    print(f"{tier}: significant effects on {sig}")

10. What's Next

Planned Features

Research Extensions

Architecture

crop_models.py  β€” CropGrowthState, LivestockGrowthState, WeatherEngine, SpotPriceEngine
agents.py       β€” Plot, Farmer, Investor, Bank, PriceManager
model.py        β€” AgriMarketModel (Mesa 3.5 ABM orchestrator)
metrics.py      β€” compute_run_metrics, run_monte_carlo, compute_effect_sizes
app.py          β€” Streamlit dashboard with step-through playback

Built with Mesa 3.5 (agent-based modeling), Streamlit (dashboard), Plotly (visualization), and Python 3.12.