---
kind: concept
slug: quantile-regression-forest
title: Quantile regression forest
summary: >-
  A random forest that predicts conditional quantiles rather than a mean, so each input gets a distribution. Used with a per-unit lognormal fit and Monte Carlo sampling to aggregate uncertainty. One card so far, author-reported, with no public training data: the method is clear, its accuracy is not independently checked.
tags: [quantile-regression, random-forest, uncertainty-estimation, probabilistic-prediction, spatial-prediction, survey-data, environmental-epidemiology]
papers: ["2310.11143"]
related: [random-forest, uncertainty-estimation, conformal-prediction]
status: draft
updated_at: 2026-11-08
---

## Overview

A quantile regression forest predicts conditional quantiles of the target
instead of only its mean, so each input gets a predicted distribution. The
problem it addresses: a mean hides the tails, and questions such as "what share
of homes exceed a reference value" need the distribution, not a conditional
mean [arxiv:2310.11143 p. 2]. The method predicts several quantiles per row and
turns them into a distribution that can be sampled and aggregated
[arxiv:2310.11143 p. 7].

Only one card in the corpus names this method. Its evidence therefore comes
from one application: indoor radon in Germany, trained on a survey of 14,053
measurements [arxiv:2310.11143 p. 7]. Treat the variant below as one worked
design, not a benchmarked family.

## Variants

### Quantile readout with a per-row lognormal and Monte Carlo aggregation

The forest is a conditional random forest with 500 trees and mtry 4
[arxiv:2310.11143 p. 7]. For each row, nine quantiles are predicted, at the
10th, 25th, 50th, 75th, 80th, 85th, 90th, 95th and 98th percentile
[arxiv:2310.11143 p. 7]. A local offset (outdoor radon) is subtracted from the
quantiles, and a three-parameter lognormal is fitted to the remainder
[arxiv:2310.11143 p. 7]. Samples are drawn from each row's lognormal in
proportion to the expected population of that row, the offset is added back,
and the draws are grouped for summaries [arxiv:2310.11143 p. 7]. Card:
[High-resolution indoor radon map](/papers/2310.11143).

The paper's stated loss is RMSE on the untransformed target [arxiv:2310.11143
p. 6]. Two details that matter for reimplementation are in the authors' code,
not the paper: a clamp that keeps the offset below the 10th percentile, and
fit weights of 1 to 6 that rise with percentile [arxiv:2310.11143 code:
IRC prediction individual buildings.R#L191-L195] [arxiv:2310.11143 code: IRC
prediction individual buildings.R#L202].

## When to use which

| Situation | Use | Why |
|---|---|---|
| The question needs a share above a threshold, or a tail | Quantile readout, then sample the distribution | The paper reports exceedance probabilities that depend on the distribution, not a mean [arxiv:2310.11143 p. 2] [arxiv:2310.11143 p. 9] |
| Training data are a biased sample, but predictors exist for every unit | Forest on mappable predictors, then predict for all units | The model is meant to correct sampling bias and predict below the survey's own regions [arxiv:2310.11143 p. 2] |
| Predictors are mixed continuous and categorical, and the table has thousands of rows | A forest with forward predictor selection | The paper used 12 selected predictors, eight continuous and four building-related [arxiv:2310.11143 p. 7] |
| Observations are spatially clustered | Spatial cross-validation folds, not random folds | The paper used 10 folds with 40 km blocks for selection and evaluation [arxiv:2310.11143 p. 7] |
| Intervals must be trusted at the tails | Check coverage per quantile on held-out data before use | The 80% and 50% intervals covered 78.2% and 49.1% [arxiv:2310.11143 p. 9]; the 10th and 98th percentiles were off by about one point [arxiv:2310.11143 p. 11] |
| Per-unit precision matters | Be cautious for single units; report intervals | The paper reports smoothing at both ends [arxiv:2310.11143 p. 9] and wide per-building intervals [arxiv:2310.11143 fig. 8] |
| The output will be large | Plan storage and chunked processing | The run produced about 840 million samples, written in chunks [arxiv:2310.11143 p. 7] |

## Implementation sketch

The sketch follows the paper's steps. Where the code adds a step that the paper
does not describe, the comment says so.

```pseudocode
# Fit a quantile regression forest on survey rows  [arxiv:2310.11143 p. 7]
# Input:  rows (target, predictors), spatial folds
# Output: forest that returns conditional quantiles

def fit_forest(rows, predictors, spatial_folds):
    # Forward selection by spatial-CV RMSE  [arxiv:2310.11143 p. 7]
    selected = forward_select(rows, predictors, spatial_folds)
    # Final fit: 500 trees, mtry 4  [arxiv:2310.11143 p. 7]
    return grow_forest(rows[selected], ntree=500, mtry=4)

# Sample one row's distribution  [arxiv:2310.11143 p. 7]
# Input:  row predictors, weight (expected people), offset
# Output: integer samples, or none when the weight is tiny

def sample_row(forest, row, weight, offset):
    # Nine conditional quantiles for this row  [arxiv:2310.11143 p. 7]
    q = forest.predict_quantiles(row, [0.10, 0.25, 0.5, 0.75, 0.8,
                                       0.85, 0.9, 0.95, 0.98])
    # Code-only clamp: keep the offset below the 10th percentile
    # [arxiv:2310.11143 code: IRC prediction individual buildings.R#L191-L195]
    offset = min(offset, q[0] - 1)
    # Fit a lognormal to the shifted quantiles; code uses weights 1..6
    # [arxiv:2310.11143 p. 7]
    # [arxiv:2310.11143 code: IRC prediction individual buildings.R#L202]
    shifted = [x - offset for x in q]
    mu, sigma = fit_lognormal(shifted, weights=[1, 2, 3, 4, 5, 6, 6, 6, 6])
    # Samples scale with weight; zero after rounding means no samples
    # [arxiv:2310.11143 p. 7]
    n = round(10 * weight)
    return [round(x + offset) for x in lognormal(mu, sigma, n)]
```

## Contradictions

None across cards, since there is one card. Within the paper and its code, two
things do not line up. The paper writes the exceedance threshold once as
"exceedance of 300" and once as "> 300 Bq/m³", and it does not say whether
equal values count; the code counts them [arxiv:2310.11143 p. 9]
[arxiv:2310.11143 p. 13] [arxiv:2310.11143 code: aggregate predictions.R#L119-L122].
Pick one rule and state it. The paper's final predictor set cannot be checked
against the code, because the selected set is not written to disk
[arxiv:2310.11143 code: model building.R#L66-L75].

## Papers

- [High-resolution indoor radon map](/papers/2310.11143): a quantile regression forest, per-floor lognormal fits and Monte Carlo sampling for German homes. Author-reported, with the survey data not public.
