Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

cluster_bootstrap

Estimate a paired score-difference interval by resampling whole event clusters.

Contract

At least two clusters and 100..100000 replicates are required, capped at 10 million draws. Clusters must be independent under the model. This example intentionally shows a degenerate interval; it is not proof of no uncertainty.

Fields

FieldTypeRequired
casesarray of CaseYes
confidencenumberYes
op"cluster_bootstrap"Yes
resamplesintegerYes
seedintegerYes

This operation needs no existing question or forecast. Use --memory for a calculation-only session.

Request

Send this object on one line. It is expanded below for readability.

{
  "version": 1,
  "id": "example",
  "command": {
    "op": "cluster_bootstrap",
    "cases": [
      {
        "question_id": "a",
        "cluster_id": "a",
        "forecast_at": 1,
        "resolved_at": 5,
        "model": 0.5,
        "baseline": 0.5,
        "outcome": true
      },
      {
        "question_id": "b",
        "cluster_id": "b",
        "forecast_at": 1,
        "resolved_at": 5,
        "model": 0.5,
        "baseline": 0.5,
        "outcome": false
      }
    ],
    "resamples": 100,
    "confidence": 0.95,
    "seed": 7
  }
}

Response

This response is generated by executing the example against the current binary. Commit timestamps, when present, are shown as <runtime UTC seconds>; the actual protocol returns integer UTC seconds.

{
  "version": 1,
  "id": "example",
  "result": {
    "clusters": 2,
    "confidence": 0.95,
    "degenerate": true,
    "difference": 0.0,
    "high": 0.0,
    "low": 0.0,
    "method": "paired_cluster_percentile",
    "questions": 2,
    "resamples": 100,
    "seed": 7,
    "standard_error": 0.0
  }
}

Verification

The documentation gate executes the setup and request, then checks the following result fields against independently specified expectations:

JSON pointer within resultExpected
/clusters2
/low0.0
/high0.0
/degeneratetrue

Float comparisons use a 1e-12 tolerance. Request schema validation and cross-record validation still apply. See errors and recovery for failure handling.