API reference
Rates and changes
How the API represents every percentage and every comparison.
The rate object
Every percentage in the API is a rate object:
JSON
{ "k": 167, "n": 444, "rate": 0.376, "low": 0.332, "high": 0.422 }| Field | Type | Description |
|---|---|---|
k |
integer | Answers that matched, like answers naming you |
n |
integer | Answers counted |
rate |
number | k / n, from 0 to 1, rounded to three places |
low, high |
number | The 95% Wilson range. 0 and 1 when n is 0 |
To combine rates, add their k and n and divide. Never average rate values.
The change object
Rates that compare with a previous period have a change:
JSON
{
"delta": 0.194,
"significant": true,
"direction": "up",
"pairs": 111,
"prev": { "k": 101, "n": 555, "rate": 0.182, "low": 0.152, "high": 0.216 },
"cur": { "k": 167, "n": 444, "rate": 0.376, "low": 0.332, "high": 0.422 }
}| Field | Description |
|---|---|
delta |
cur.rate − prev.rate |
significant |
true when the two 95% ranges don't overlap |
direction |
up or down when significant, otherwise flat |
pairs |
Prompt and surface combinations measured in both periods |
prev, cur |
Rate objects for each period, over those pairs only |
change is null when there's no previous period or no pairs. Because it uses only pairs, change.cur can differ slightly from the headline rate. Confidence and significance explains why.