Use Statistics Calculator

Enter your data below to use the Statistics Calculator

📌 Try these examples:
RESULT

Last updated

Descriptive Statistics Overview

Descriptive statistics summarize and describe the main features of a dataset. Unlike inferential statistics (which draw conclusions about populations from samples), descriptive statistics simply describe what the data shows. The key measures are central tendency (mean, median, mode) and dispersion (range, variance, standard deviation).

Measures of Central Tendency

MeasureFormulaBest For
MeanΣx / nSymmetric distributions without outliers
MedianMiddle value when sortedSkewed distributions, income data
ModeMost frequent valueCategorical data, finding peaks
Geometric mean(x₁ × x₂ × ... × xₙ)^(1/n)Growth rates, ratios

Full Statistics in JavaScript

JavaScript
function statistics(data) {
  const sorted = [...data].sort((a, b) => a - b);
  const n = data.length;
  const sum = data.reduce((a, b) => a + b, 0);
  const mean = sum / n;

  // Median
  const mid = Math.floor(n / 2);
  const median = n % 2 ? sorted[mid] : (sorted[mid-1] + sorted[mid]) / 2;

  // Mode
  const freq = {};
  data.forEach(x => freq[x] = (freq[x] || 0) + 1);
  const maxFreq = Math.max(...Object.values(freq));
  const mode = Object.keys(freq).filter(k => freq[k] === maxFreq).map(Number);

  // Variance & std dev
  const variance = data.reduce((s, x) => s + Math.pow(x - mean, 2), 0) / (n - 1);
  const stdDev = Math.sqrt(variance);

  return {
    count: n, sum, mean, median, mode,
    min: sorted[0], max: sorted[n-1],
    range: sorted[n-1] - sorted[0],
    variance: variance.toFixed(4),
    stdDev: stdDev.toFixed(4),
    q1: sorted[Math.floor(n * 0.25)],
    q3: sorted[Math.floor(n * 0.75)]
  };
}

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.