# Descriptive Statistics Calculator

• /
• Blog
• /
• Descriptive Statistics Calculator

# Descriptive StatisticsCalculator

Enter numbers separated by commas:

Value
``` function calculateDescriptiveStatistics() { const input = document.getElementById('numbers-input').value; const output = document.getElementById('output').querySelector('tbody'); const numbers = input.split(',').map(num => parseFloat(num.trim())).filter(num => !isNaN(num)); if (numbers.length === 0) { alert('Please enter a valid comma-separated list of numbers.'); return; } // Calculations const count = numbers.length; const sum = numbers.reduce((sum, num) => sum + num, 0); const mean = sum / count; const sortedNumbers = numbers.slice().sort((a, b) => a - b); const median = count % 2 === 0 ? (sortedNumbers[count / 2 - 1] + sortedNumbers[count / 2]) / 2 : sortedNumbers[Math.floor(count / 2)]; const mode = [...numbers.reduce((countMap, num) => { countMap.set(num, (countMap.get(num) || 0) + 1); return countMap; }, new Map()).entries()].reduce((max, entry) => { return entry[1] > max[1] ? entry : max; }, [null, 0])[0]; const variance = numbers.reduce((sum, num) => sum + Math.pow(num - mean, 2), 0) / (count - 1); const variancePopulation = numbers.reduce((sum, num) => sum + Math.pow(num - mean, 2), 0) / count; const standardDeviation = Math.sqrt(variance); const standardDeviationPopulation = Math.sqrt(variancePopulation); const min = sortedNumbers[0]; const max = sortedNumbers[count - 1]; const range = max - min; const q1 = sortedNumbers[Math.floor(count * 0.25)]; const q3 = sortedNumbers[Math.floor(count * 0.75)]; const iqr = q3 - q1; const skewness = numbers.reduce((sum, num) => sum + Math.pow(num - mean, 3), 0) / count / Math.pow(standardDeviationPopulation, 3); const kurtosis = numbers.reduce((sum, num) => sum + Math.pow(num - mean, 4), 0) / count / Math.pow(standardDeviationPopulation, 4) - 3; const rows = [ ['Count', count], ['Sum', sum.toFixed(2)], ['Min', min.toFixed(2)], ['Max', max.toFixed(2)], ['Range', range.toFixed(2)], ['Mean', mean.toFixed(2)], // ['Mode', mode !== null ? mode.toFixed(2) : 'N/A'], ['Median', median.toFixed(2)], ['Standard Deviation (Sample)', standardDeviation.toFixed(2)], ['Standard Deviation (Population)', standardDeviationPopulation.toFixed(2)], ['Variance (Sample)', variance.toFixed(2)], ['Variance (Population)', variancePopulation.toFixed(2)], // ['Q1 (25th Percentile)', q1.toFixed(2)], // ['Q3 (75th Percentile)', q3.toFixed(2)], // ['<a href="https://www.qualitygurus.com/calculating-the-interquartile-range-a-quick-guide/" target="_blank">IQR</a>', iqr.toFixed(2)], ['Skewness', skewness.toFixed(2)], ['Kurtosis', kurtosis.toFixed(2)] ]; output.innerHTML = rows.map(([label, value]) => { return `<tr><td>\${label}</td><td>\${value}</td></tr>`; }).join(''); } document.addEventListener('DOMContentLoaded', calculateDescriptiveStatistics); ```

Posted on April 7, 2023 by  Quality Gurus

## SALE! 4 Most Popular Courses

``` (adsbygoogle = window.adsbygoogle || []).push({}); ```

###### Quality Gurus

Customers served! 1

Quality Management Course

FREE! Subscribe to get 52 weekly lessons. Every week you get an email that explains a quality concept, provides you with the study resources, test quizzes, tips and special discounts on our other e-learning courses.

``` (adsbygoogle = window.adsbygoogle || []).push({}); ```

Similar Posts:

December 27, 2022

## Exponential Distribution

Exponential Distribution

November 23, 2021

## Difference and similarities between the Six Sigma DMAIC and DMADV methodologies

Difference and similarities between the Six Sigma DMAIC and DMADV methodologies

November 27, 2021

## The Future of Quality: Quality 4.0

The Future of Quality: Quality 4.0

April 26, 2018

## Six Sigma = 3.4 DPMO … Why?

Six Sigma = 3.4 DPMO … Why?

December 20, 2022

## Common Types of Hypothesis Tests

Common Types of Hypothesis Tests

March 10, 2019

## Six Sigma Certification – ASQ® or IASSC?

Six Sigma Certification – ASQ® or IASSC?

December 24, 2021

## Seven Quality Tools – Histogram

Seven Quality Tools – Histogram

December 23, 2021

## Converting VoC to CTQs

Converting VoC to CTQs

April 10, 2022

## Statistics, Data Analysis Using MS Excel – Quiz

Statistics, Data Analysis Using MS Excel – Quiz

32 Courses on SALE!