Statistics Utilities

Calculate Quartiles

Computes first, second, and third quartiles (Q1, Q2, Q3) from numerical datasets. Use via MCP in Cursor or Windsurf for instant statistical analysis, or call GET /v1/stats/quartiles with your data array. Returns precise quartile values using standard calculation methods, perfect for box plot generation or outlier detection in AI-driven data analysis workflows.

API Endpoint

GET /v1/stats/quartiles

Code Examples

curl "https://tinyfn.io/v1/stats/quartiles" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/quartiles', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/stats/quartiles',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's statistics tools:

{
  "mcpServers": {
    "tinyfn-stats": {
      "url": "https://tinyfn.io/mcp/stats",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I calculate quartiles for a dataset using MCP?

Pass your numerical array to the quartiles tool in your MCP-enabled editor. It returns Q1 (25th percentile), Q2 (median), and Q3 (75th percentile) values.

What quartile calculation method does TinyFn use?

Uses the standard method where Q1 is the median of the lower half, Q2 is the overall median, and Q3 is the median of the upper half of sorted data.

Can I calculate quartiles for datasets with odd or even number of elements?

Yes, the tool handles both cases correctly. For odd-sized datasets, it excludes the median when splitting halves; for even sizes, it splits exactly in half.

What's the difference between quartiles and percentiles?

Quartiles are specific percentiles: Q1 = 25th percentile, Q2 = 50th percentile (median), Q3 = 75th percentile. Quartiles divide data into four equal parts.

How do I use quartiles to identify outliers in my data?

Calculate IQR (Q3 - Q1), then flag values below Q1 - 1.5×IQR or above Q3 + 1.5×IQR as potential outliers using the standard box plot method.

Try Calculate Quartiles Now

Get your free API key and start using Calculate Quartiles in seconds.

Get Free API Key