Population variance calculator
The population variance calculator measures how widely every value in a complete population is spread around that population's mean.
Run — free
Provide a non-empty array of numbers and receive the count, arithmetic mean, summed squared deviations, and population variance. Unlike sample variance, this calculation divides by N because the supplied values represent the whole population rather than observations intended to estimate a larger group. The result is deterministic, requires no network access, and can be reproduced from the returned intermediate values.
Use population variance for the complete group
Population variance is appropriate when your array contains every member of the group you intend to describe. Examples include all daily measurements recorded during a fixed experiment, every transaction in a closed accounting period, or the scores of every participant in a completed class. The calculator first counts the values and computes their arithmetic mean. It then measures each value's distance from that mean, squares each distance so negative and positive differences do not cancel, adds those squared differences, and divides the total by N. That last denominator is the defining choice. If the array is only a sample selected to infer the behavior of a larger population, sample variance with an N minus one denominator is generally the relevant statistic instead. Be precise about what the data represents before interpreting the result. A complete population is defined by the scope of your question, not merely by whether the array happens to include all values currently available to you.
Read and verify the returned result
The response includes count, mean, sum_squared_deviations, and population_variance. Count is N, the number used as the divisor. Mean is the center against which every deviation is measured. The summed squared deviations expose the numerator, making the final calculation easy to audit: divide sum_squared_deviations by count and you obtain population_variance. Variance is expressed in squared units, so a population measured in meters has variance measured in square meters. This makes variance excellent for comparisons and later formulas, but standard deviation may be easier to explain because it returns to the original unit. A variance of zero means every member has exactly the same value. Larger nonnegative results indicate greater spread, although their practical meaning depends on the scale and subject. Floating-point arithmetic follows JavaScript number behavior, so decimal inputs can produce the tiny representation effects common to binary arithmetic. The calculator does not silently round or replace those computational results.
Prepare valid data and avoid common mistakes
Send the values field as a JSON array containing at least one finite number. Zero, negative values, decimals, and repeated values are valid because variance describes spread without requiring positive or unique observations. Empty arrays are rejected because a mean and an N-divided variance cannot be defined when N is zero. Text such as a numeric-looking string is also rejected rather than guessed, and NaN or infinity cannot be represented as valid finite observations. Remove labels, missing-value markers, and units before submitting the population, but do not remove legitimate repeated values: frequency is part of the population and directly affects its mean and variance. Keep the array's scope consistent. Mixing measurements from unrelated populations can create a mathematically valid number that answers no useful question. For automated workflows, retain the returned count and numerator beside the variance so downstream reviewers can confirm the denominator and distinguish this population result from sample variance. API execution costs $0.002 per request, while the browser runner provides the same deterministic core calculation.
What you can do with it
Measure a complete production run
Quantify variation across every unit measured in a finished batch when the batch itself is the population of interest.
Summarize a closed reporting period
Calculate the spread of all daily totals in a completed month or quarter without applying a sample correction.
Audit a statistics pipeline
Compare the returned count and summed squared deviations with an existing system before accepting its population variance.
FAQ
What denominator does this calculator use?
It divides the sum of squared deviations from the mean by N, the number of values in the complete population.
How is population variance different from sample variance?
Population variance uses N. Sample variance commonly uses N minus one when a sample is used to estimate a larger population.
Can the population contain one value?
Yes. A one-value population has a mean equal to that value and a population variance of zero.
Why does an empty array return an error?
An empty population has N equal to zero, so its mean and population variance are undefined.
What does API execution cost?
Each API request costs $0.002. The browser runner uses the same deterministic calculation.
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/population-variance \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"values":[2,4,4,4,5,5,7,9]}'const res = await fetch("https://api.kit.forhosting.com/stat/population-variance", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"values": [
2,
4,
4,
4,
5,
5,
7,
9
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/population-variance",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"values": [
2,
4,
4,
4,
5,
5,
7,
9
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/population-variance", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"values":[2,4,4,4,5,5,7,9]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"values":[2,4,4,4,5,5,7,9]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/population-variance", 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": [
2,
4,
4,
4,
5,
5,
7,
9
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.population_variance",
"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. |