ForHosting KIT · Developer Utilities

Bartlett test calculator

Bartlett's test compares the variances of two or more independent groups and reports a chi-square test statistic with its p-value.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Enter each group as a separate numeric array, and the calculator returns group means, unbiased sample variances, the pooled variance, degrees of freedom, and the corrected Bartlett statistic. The method is designed for data that are reasonably consistent with normal distributions. It is especially useful before procedures whose interpretation depends on equal variances, while making the assumptions and intermediate quantities visible for review.

Prepare groups that represent independent samples

Create one group for every population, treatment, process, or condition whose variance you want to compare. Each group needs at least two finite numeric observations because a sample variance cannot be estimated from a single value. Labels are optional, but meaningful names make the returned summaries easier to audit. Do not combine repeated measurements from one subject as though they were independent observations, and do not split one sample merely to increase the number of groups. Bartlett's test addresses equality of population variances across independent groups. It does not test whether group means are equal. Before submitting data, check units and data collection rules: comparing measurements in centimeters with another group recorded in millimeters creates a variance difference that reflects scaling rather than the underlying process. The calculator uses every supplied observation, computes each arithmetic mean, and calculates each unbiased sample variance with a denominator of n minus one. Missing, textual, infinite, and nonnumeric values are rejected instead of silently removed, so the effective sample sizes always match the arrays you provided. A group in which every observation is identical is also rejected because its zero variance makes the logarithmic Bartlett formula undefined.

Understand the statistic and p-value

The calculation first pools the within-group sums of squares, weighting every sample variance by its degrees of freedom. It then compares the logarithm of that pooled variance with the weighted logarithms of the individual sample variances. A correction factor accounts for the number and sizes of the groups, producing Bartlett's statistic. Under the null hypothesis that all population variances are equal, and assuming normal observations, this statistic is approximately chi-square distributed with one fewer degree of freedom than the number of groups. The returned p-value is the upper-tail probability of obtaining a statistic at least this large under that null hypothesis. A small p-value is evidence against equal variances; it is not the probability that the null hypothesis is true, and it does not measure the practical importance of a difference. Choose a significance level before inspecting the result, commonly 0.05 when appropriate for the study, then compare the p-value with that threshold. Also examine the returned group variances and sample sizes. They explain which groups differ and help distinguish a meaningful variance contrast from a result driven by a large amount of data.

Respect normality and report the result clearly

Bartlett's test is powerful when observations within every group are normally distributed, but it is sensitive to skewness, heavy tails, and outliers. A significant result can therefore reflect nonnormal shape rather than a genuine difference in population variances. Review plots, subject-matter knowledge, and appropriate normality diagnostics before relying on the test. When normality is doubtful, consider a variance test designed to be more robust, such as Levene's test or the Brown–Forsythe variant. No automatic diagnostic can replace understanding how the sample was collected. In a report, state the number of groups, their sample sizes, Bartlett's statistic, degrees of freedom, p-value, chosen significance level, and the conclusion in context. Avoid writing that variances are proven equal when the result is not significant; the data may simply lack enough precision to detect a difference. Instead, say that the test did not find sufficient evidence of unequal variances. The API runs the same deterministic arithmetic for every request, without network access or randomness, and costs $0.002 per request. Preserve the original observations and analysis plan alongside the output so another analyst can reproduce both the calculation and the interpretation.

Check an ANOVA assumption

Compare variation across treatment groups before interpreting a classical analysis of variance that assumes homogeneous variances.

Compare process consistency

Test whether measurements from several normally distributed production lines show evidence of different process variability.

Audit laboratory precision

Evaluate equality of variance across instruments, sites, or controlled conditions while retaining group-level summaries.

What is the null hypothesis?

The null hypothesis is that every represented population has the same variance; the alternative is that at least one variance differs.

How many observations does each group need?

Every group needs at least two finite numeric observations. More observations generally provide a more reliable variance estimate.

Why are constant groups rejected?

A constant group has zero sample variance, and Bartlett's formula contains the logarithm of each variance, so the statistic is undefined.

Does a large p-value prove equal variances?

No. It means the test did not find sufficient evidence against equality at the chosen threshold; limited sample sizes may hide real differences.

When should I avoid Bartlett's test?

Use caution when groups are notably skewed, heavy-tailed, or affected by outliers. A robust test such as Levene's or Brown–Forsythe may be preferable.

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/bartlett-test

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/bartlett-test \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"groups":[{"name":"Control","values":[10,12,9,11,13]},{"name":"Treatment A","values":[8,14,10,12,11]},{"name":"Treatment B","values":[9,15,7,13,10]}]}'
{
  "groups": [
    {
      "name": "Control",
      "values": [
        10,
        12,
        9,
        11,
        13
      ]
    },
    {
      "name": "Treatment A",
      "values": [
        8,
        14,
        10,
        12,
        11
      ]
    },
    {
      "name": "Treatment B",
      "values": [
        9,
        15,
        7,
        13,
        10
      ]
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.bartlett_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.

Per request$0.002

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

max_groups100
max_values_per_group10000
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.

Read the full KIT documentation →