ForHosting KIT · Math

Deviation scores calculator

In a set whose mean is 9, the value 4 scores −5, 7 scores −2 and 10 scores 1: the sign tells you above or below the average, the size tells you by how much. Scores come back in your original order. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Values
4, 7, 10, 15
You get
Mean
9
Deviation scores
-5, -2, 1, 6

A deviation score shows how far a value sits above or below the arithmetic mean of its data set. This calculator accepts one non-empty array, computes its mean, and returns a signed score for every item in the original order. Positive results are above the mean, negative results are below it, and zero marks a value equal to the mean. The calculation is deterministic and uses no network services, random sampling, or stored state.

What a deviation score tells you

A deviation score is the simplest centered form of a numerical observation. For each item, subtract the arithmetic mean of the complete array from that item. The sign immediately communicates direction: a positive score places the observation above the mean, while a negative score places it below the mean.

Its magnitude gives the distance in the same units as the original values. If a class has test results measured in points, the deviation scores are also measured in points; if a sensor reports degrees, its deviations remain degrees. This direct interpretation makes the calculation useful before more elaborate statistics are introduced.

The response preserves input order, so every returned score corresponds to the value at the same array position. It also includes the computed mean, allowing you to audit the subtraction or label a report without calculating the center again. Unlike a z-score, a deviation score is not divided by a standard deviation and is therefore not unitless.

Unlike absolute deviation, it keeps the sign instead of discarding whether the value lies above or below the center.

How the array is validated and calculated

The calculator rejects an omitted field, a non-array value, an empty array, text entries, nulls, NaN, Infinity, and values outside the documented safe magnitude. After validation, the algorithm adds every observation and divides by the number of observations to obtain the arithmetic mean. A second linear pass subtracts that mean from each original value.

Nothing is sorted, rounded, sampled, or reordered. Repeated values stay repeated, decimal inputs remain ordinary JavaScript numbers, and a one-item array correctly returns a score of zero because its only value equals its mean. As a useful consistency check, deviation scores sum to zero in exact arithmetic.

Floating-point data can produce a tiny residual when those scores are added again, which is a representation effect rather than a different formula.

Using deviation scores in analysis and automation

Deviation scores are a practical intermediate result whenever a workflow needs centered data but does not need scale normalization. In education, they show students exactly how individual marks relate to the class average and provide the signed terms used in variance calculations. In quality control, they expose which measurements run high or low relative to the batch center while preserving the original engineering unit.

In data preparation, subtracting the mean can center a feature before a later covariance, regression, or visualization step. Because the output order matches the input order, applications can pair scores with existing row identifiers without an extra join or sort. Invalid input is rejected before a result is produced.

This tool deliberately stops at signed differences: it does not square them, average their absolute magnitudes, estimate variance, or divide by standard deviation. Keeping that boundary clear prevents a raw deviation vector from being mistaken for a measure of spread or a standardized score.

Center a model feature

Subtract the feature mean from every observation while preserving row order for a later covariance, regression, or plotting step.

Explain results relative to an average

Show how many points each test result, survey response, or performance measure lies above or below its group mean.

Inspect a measurement batch

Return signed offsets for sensor readings or production measurements so unusually high and low observations are easy to identify.

What is the formula for a deviation score?

For each value x, the deviation score is x minus the arithmetic mean of all values in the array.

Do the deviation scores add up to zero?

They sum to zero in exact arithmetic. With decimal floating-point values, adding the returned scores may leave a very small representation residual.

Is a deviation score the same as a z-score?

No. A deviation score only subtracts the mean and keeps the original unit. A z-score also divides by a standard deviation.

What does a negative deviation score mean?

It means the value is below the mean. The size of the score is the distance in the same units as your data, so a mark measured in points gives a deviation in points and a temperature gives degrees.

Is a deviation score the same as an absolute deviation?

No. An absolute deviation drops the sign and keeps only the distance. A deviation score keeps the sign, so you still know whether each value lies above or below the center of the data.

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.

POSThttps://api.kit.forhosting.com/stat/deviation-scores

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.

curl -X POST https://api.kit.forhosting.com/stat/deviation-scores \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"values":[4,7,10,15]}'
{
  "values": [
    4,
    7,
    10,
    15
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.deviation_scores",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_items100000
max_abs1e+150
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How the array is validated and calculated

Provide values as a JSON array containing at least one finite number. It also enforces the published item limit so browser and API execution remain predictable. The endpoint returns the computed values directly and does not silently coerce numeric-looking strings, because accepting mixed types could conceal damaged data upstream.

Using deviation scores in analysis and automation

You can use the browser calculator for a quick check, then call the API at $0.002 per successful request when the same calculation belongs in a repeatable pipeline.

What happens when the array is empty?

The request fails with an invalid_input error because the arithmetic mean, and therefore every deviation score, is undefined for an empty array.

How much does the API request cost?

A successful API request costs $0.002. The same deterministic calculation can also run free in your browser.

Read the full KIT documentation →