Calculate Quantiles
statistics.quantile
Overview
You send a numeric vector and one to 101 probabilities in [0, 1]. LINEAR_R7, the default, is Hyndman–Fan type 7: h = p × (n − 1), then linear interpolation between adjacent order statistics. LOWER, HIGHER, NEAREST (half-to-even index) and MIDPOINT are the discrete alternatives. Results are ordered by probability. This is not a confidence interval, a streaming quantile, or a weighted sample.
Nine common quantile definitions disagree at the same p. Naming the method, and using type 7 as the default, makes R, NumPy and this skill comparable.
Reliability
LINEAR_R7 matches Hyndman–Fan type 7 and NumPy linear. Permuting values does not change the result. SERIES_INVALID — trigger: every observation was null under OMIT, or a null arrived under REJECT; retryable: no; next: send at least one finite number. ITEM_LIMIT_EXCEEDED — trigger: more than 100000 values or more than 101 probabilities; retryable: no; next: split the request.
Context footprint
One vector and a short probability list in. A successful call costs 1 execution credit.
When to use it
When you need one or more empirical quantiles and must name the interpolation.
When you only want the sample median, or Q1 and Q3 as a single spread figure.
Scope
Non-goals
- Does not compute confidence intervals or approximate/streaming quantiles
- Does not weight observations or group by a second key
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| values | array | Yes | Required 1 to 100000 finite numbers. One extra slot exists in the schema so the typed ITEM_LIMIT_EXCEEDED failure is reachable at 100001. |
| probabilities | array | Yes | Required 1 to 101 probabilities in [0, 1]. One extra schema slot makes the typed item limit reachable. |
| method | string | No | Interpolation method; omit it for LINEAR_R7. |
| nullPolicy | string | No | REJECT fails on any JSON null; OMIT drops nulls and reports omittedCount. Omit this field and we REJECT. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| quantiles | array | Yes | From 1 through 101 probability/value pairs, ordered by probability. |
| method | string | Yes | Applied interpolation method. |
| count | integer | Yes | Finite observations used. |
| omittedCount | integer | Yes | How many JSON null observations were dropped under OMIT; zero under REJECT. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"statistics.quantile","input":{"values":[1,2,3,4,5],"probabilities":[0,0.5,1]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("statistics.quantile", {"values":[1,2,3,4,5],"probabilities":[0,0.5,1]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| SERIES_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ITEM_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not compute confidence intervals or approximate/streaming quantiles
- Does not weight observations or group by a second key
- Only the sample median (use statistics.median)
- Q1, Q3 and their difference together (use statistics.interquartile_range)
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "statistics.quantile",
"input": {
"values": [
1,
2,
3,
4,
5
],
"probabilities": [
0,
0.5,
1
]
}
}Examples
Type-7 endpoints and the sample median
{
"values": [
1,
2,
3,
4,
5
],
"probabilities": [
0,
0.5,
1
]
}{
"quantiles": [
{
"value": 1,
"probability": 0
},
{
"value": 3,
"probability": 0.5
},
{
"value": 5,
"probability": 1
}
],
"omittedCount": 0,
"count": 5,
"method": "LINEAR_R7"
}Nearest half-to-even index on an even sample
{
"probabilities": [
0.5
],
"values": [
1,
2,
3,
4
],
"method": "NEAREST"
}{
"quantiles": [
{
"value": 3,
"probability": 0.5
}
],
"omittedCount": 0,
"count": 4,
"method": "NEAREST"
}Recommended use cases
- Hyndman–Fan type 7 percentiles that match R and NumPy linear
- Comparing LOWER, HIGHER, NEAREST and MIDPOINT on the same sample
Avoid for
- Only the sample median (use statistics.median)
- Q1, Q3 and their difference together (use statistics.interquartile_range)
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.