Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Descriptive Statistics

Descriptive Statistics is broken down into Tendency and Variability.

Tendency is about Center Measures:

  • The Mean (the average value)
  • The Median (the mid point value)
  • The Mode (the most common value)

The Mean

The Mean Value is the Average of all values.

This table contains 11 values:

7889991011141415

To find the Mean Value: Add all values and divide by the number of values.

The Mean Value is:
(7+8+8+9+9+9+10+11+14+14+15)/11 = 10.3636363636.

The Mean is the Sum divided by the Count.

Calculate the Mean Value:

let mean = (7+8+8+9+9+9+10+11+14+14+15)/11;

Try it Yourself »

Or use a math library like math.js:

const values = [7,8,8,9,9,9,10,11,14,14,15];
let mean = math.mean(values);

Try it Yourself »


The Median

A list of speed values:

99,86,87,88,111,86,103,87,94,78,77,85,86

The Median is the value in the middle (after the values are sorted):

77,78,85,86,86,86,87,87,88,94,99,103,111

Calculate the median:

const speed = [99,86,87,88,111,86,103,87,94,78,77,85,86];
let median = math.median(speed);

Try it Yourself »

If there are two numbers in the middle, divide the sum of them by two.

77,78,85,86,86,86,87,87,88,94,99,103
(86 + 87) / 2 = 86.5

Calculate the median:

const speed = [99,86,87,88,86,103,87,94,78,77,85,86];
let median = math.median(speed);

Try it Yourself »


The Mode

The Mode Value is the value that appears the most number of times:

99,86,87,88,111,86,103,87,94,78,77,85,86

Calculate the mode:

const speed = [99,86,87,88,86,103,87,94,78,77,85,86];
let mode = math.mode(speed);

Try it Yourself »


Outliers

Outliers are values "outside" the other values:

99,86,87,88,111,86,103,87,94,78,300,85,86

Outliers can change the mean a lot. Sometimes we don't use them (they might be an error), or we use the median or the mode instead.

Calculate the Mean:

const values = [99,86,87,88,111,86,103,87,94,78,300,85,86];
let mean = math.mean(values);

Try it Yourself »


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.