Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Calculate Quantiles

statistics.quantile

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

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

Note
Returns one or more empirical quantiles of a bounded finite numeric vector.

Non-goals

  • Does not compute confidence intervals or approximate/streaming quantiles
  • Does not weight observations or group by a second key

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysismath

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive input, safe output
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
valuesarrayYesRequired 1 to 100000 finite numbers. One extra slot exists in the schema so the typed ITEM_LIMIT_EXCEEDED failure is reachable at 100001.
probabilitiesarrayYesRequired 1 to 101 probabilities in [0, 1]. One extra schema slot makes the typed item limit reachable.
methodstringNoInterpolation method; omit it for LINEAR_R7.
nullPolicystringNoREJECT fails on any JSON null; OMIT drops nulls and reports omittedCount. Omit this field and we REJECT.

Output schema

FieldTypeRequiredDescription
quantilesarrayYesFrom 1 through 101 probability/value pairs, ordered by probability.
methodstringYesApplied interpolation method.
countintegerYesFinite observations used.
omittedCountintegerYesHow many JSON null observations were dropped under OMIT; zero under REJECT.

API contract

POST /v1/execute
curl
curl -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]}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
SERIES_INVALID400NoThe request payload failed this skill's input validation.
ITEM_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "skillKey": "statistics.quantile",
  "input": {
    "values": [
      1,
      2,
      3,
      4,
      5
    ],
    "probabilities": [
      0,
      0.5,
      1
    ]
  }
}

Examples

Type-7 endpoints and the sample median

Inputjson
{
  "values": [
    1,
    2,
    3,
    4,
    5
  ],
  "probabilities": [
    0,
    0.5,
    1
  ]
}
Expected outputjson
{
  "quantiles": [
    {
      "value": 1,
      "probability": 0
    },
    {
      "value": 3,
      "probability": 0.5
    },
    {
      "value": 5,
      "probability": 1
    }
  ],
  "omittedCount": 0,
  "count": 5,
  "method": "LINEAR_R7"
}
Tip
h = p × 4, so 0 and 1 are the min and max and 0.5 is the middle sample

Nearest half-to-even index on an even sample

Inputjson
{
  "probabilities": [
    0.5
  ],
  "values": [
    1,
    2,
    3,
    4
  ],
  "method": "NEAREST"
}
Expected outputjson
{
  "quantiles": [
    {
      "value": 3,
      "probability": 0.5
    }
  ],
  "omittedCount": 0,
  "count": 4,
  "method": "NEAREST"
}
Tip
h = 1.5 ties to even index 2, which is the value 3
  • 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)

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.

Tags

analysismathstatistics