Grubbs outlier test calculator
Check whether one value sits suspiciously far from the rest: in 10, 11, 10, 12 and 50, the candidate is 50, set against a mean of 18.6 and the sample standard deviation. You get G to compare with your critical value. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Values
- 10, 11, 10, 12, 50
- Quantity
- 5
- Mean
- 18.6
- Standard deviation
- 17.5727061092
- Statistic
- 1.7868619554
The Grubbs outlier test calculator measures how far the most extreme observation lies from the sample mean relative to the sample standard deviation. Submit at least three finite numbers and the calculator returns the two-sided Grubbs G statistic, the candidate value, its original array index, the mean, and the sample standard deviation. This result supports a test for one possible outlier in approximately normally distributed data. It deliberately reports the statistic rather than silently choosing a significance threshold, so you can compare it with the critical value appropriate to your sample size and analysis plan.
How the Grubbs statistic is calculated
The calculator first validates that values is an array containing at least three finite numbers. It computes the arithmetic mean of the complete sample, then calculates the sample standard deviation using a denominator of n minus one. For every observation, it finds the absolute distance from the mean.
The observation with the largest absolute distance is the candidate single outlier, and the Grubbs statistic G is that maximum distance divided by the sample standard deviation. Because absolute distance is used, this is the usual two-sided form: an unusually small value and an unusually large value are considered on equal terms. If two values have exactly the same maximum absolute deviation, the first one in input order is selected, making the output deterministic.
The calculation uses every submitted observation, including the candidate, when finding the mean and standard deviation, as required by the statistic. No value is removed or altered during computation.
When a Grubbs result is appropriate
Grubbs' test is designed to evaluate one suspected outlier in a sample that can reasonably be treated as coming from an approximately normal population. A large statistic means the most extreme observation is far from the sample mean in standard-deviation units, but G alone is not a reject decision. Compare it with the correct critical value or use a properly defined p-value procedure before concluding that the candidate is statistically significant.
Check distributional assumptions with subject-matter knowledge and useful diagnostics, especially for skewed, heavy-tailed, multimodal, or time-dependent data. The test can behave poorly when normality is implausible. It also targets a single outlier: multiple unusual values can mask one another by shifting the mean and inflating the standard deviation.
If you remove a justified outlier and repeat the test, account for the sequential procedure rather than repeatedly testing until a preferred result appears. Most importantly, statistical unusualness does not prove measurement error. Investigate calibration records, collection conditions, units, transcription, and real-world explanations before deleting or replacing an observation.
Preserve the original data and record the statistic, sample size, significance rule, and decision for an auditable analysis.
What you can do with it
Review laboratory measurements
Quantify the single reading farthest from the batch mean before checking instruments, samples, and recorded units.
Screen quality-control samples
Calculate G for a small approximately normal measurement set and compare it with a preselected critical value.
Teach outlier testing
Show how the mean, sample standard deviation, maximum deviation, and Grubbs statistic connect in one transparent result.
FAQ
What does the Grubbs statistic measure?
It measures the largest absolute deviation from the sample mean divided by the sample standard deviation.
Does the calculator decide whether the value is an outlier?
No. It identifies the candidate and computes G; compare G with the appropriate critical value for your sample size, significance level, and two-sided test.
Can Grubbs' test find multiple outliers?
This calculation targets one candidate. Multiple extreme observations can mask each other, and repeated testing requires a carefully chosen sequential method.
Should I delete the value that Grubbs' test flags?
Not on the statistic alone. Being statistically unusual does not prove a measurement error, so check calibration, units, transcription and collection conditions first, and keep the original data with a note of what you decided.
How many values do I need, and what if they are all the same?
You need at least three numbers. If every value is identical the standard deviation is zero and G would mean dividing by zero, so the calculator refuses that data instead of showing a misleading result.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/stat/grubbs-test \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"values":[10,11,10,12,50]}'const res = await fetch("https://api.kit.forhosting.com/stat/grubbs-test", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"values": [
10,
11,
10,
12,
50
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/grubbs-test",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"values": [
10,
11,
10,
12,
50
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/grubbs-test", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"values":[10,11,10,12,50]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"values":[10,11,10,12,50]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/grubbs-test", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"values": [
10,
11,
10,
12,
50
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.grubbs_test",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_items | 100000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How the Grubbs statistic is calculated
The response preserves the original array position in outlier_index, reports the candidate in outlier_value, and labels its direction as low or high relative to the mean.
How to prepare input and read the result
Integers, decimals, negative numbers, repeated measurements, and zero are accepted, but numeric strings, null, NaN, infinity, and arrays with fewer than three entries are rejected. The statistic field is the computed G value. All-identical data has zero standard deviation, so G would require division by zero; the calculator reports that condition as invalid input. Retain adequate numeric precision when comparing statistic with a published critical value, and ensure that the critical-value table uses the two-sided Grubbs test, your exact sample size, and your intended significance level. Provide a JSON array in the values field. Very large magnitudes that make intermediate arithmetic non-finite also return an invalid_input error instead of a misleading result. The count field confirms the sample size, mean gives the arithmetic center, and standard_deviation gives the sample standard deviation. The outlier_value and zero-based outlier_index fields locate the single most extreme observation without sorting the submitted array, while direction shows whether it falls below or above the mean.
Technical questions
Why are at least three values required?
The requested single-outlier procedure requires a sample of at least three observations, so smaller arrays return invalid_input.
What happens when all values are identical?
Their sample standard deviation is zero, making the ratio undefined, so the calculator returns invalid_input.