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
     ❯   

描述性统计

描述性统计 分为 集中趋势离散程度

集中趋势 是关于 集中测度 的。

  • 平均数(平均值)
  • 中位数(中间值)
  • 众数(出现次数最多的值)

平均数

平均值 是所有值的 平均数

此表包含 11 个值

7889991011141415

要找到平均值:将所有值相加,然后除以值的个数。

平均值
(7+8+8+9+9+9+10+11+14+14+15)/11 = 10.3636363636.

平均数总和 除以 个数

计算平均值

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

自己尝试 »

或者使用像 math.js 这样的数学库

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

自己尝试 »


中位数

一列速度值

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

中位数 是中间的值(在值排序后)

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

计算中位数

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

自己尝试 »

如果中间有两个数字,则将它们的和除以二。

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

计算中位数

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

自己尝试 »


众数

众数 是出现次数最多的值

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

计算众数

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

自己尝试 »


离群值

离群值 是“超出”其他值的数值

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

离群值可能会极大地改变平均数。有时我们不使用它们(它们可能是错误),或者我们使用中位数或众数代替。

计算平均数

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

自己尝试 »


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

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.