# Máy tính trung bình, trung vị và mốt

> Average calculator for a list of numbers: mean, median, mode, range, count and sum, with the sorted data and the middle values highlighted.

Phiên bản tương tác: https://www.calcopenly.com/vi/math/mean-median-mode-calculator
Chủ đề: Máy tính toán học

The mean is the sum of the values divided by how many there are. The median is the middle value once the data are sorted: the value at position (n + 1) ÷ 2 when n is odd, and the average of the two middle values when n is even. The mode is the value that occurs most often, and the range is the largest value minus the smallest.

For the 10 default quiz scores the sum is 849, so the mean is 84.9. Sorted, the 5th and 6th values are 85 and 88, which puts the median at 86.5; 92 appears three times and is the mode, and the range is 95 − 70 = 25.

Data can have several modes, all listed here, or none: when every value occurs equally often, no value is more typical than another. Standard deviation, quartiles and outliers are on the descriptive statistics calculator.

## Dữ liệu đầu vào

- **Data**: Numbers separated by commas, spaces or new lines. The default is 10 quiz scores.

## Kết quả

- Mean (average) — kết quả chính
- Median
- Mode
- Range
- Count
- Sum
- Minimum
- Maximum
- Mean as a fraction

## Công thức

$$
\bar x = \frac{1}{n}\sum_{i=1}^{n} x_i \qquad \tilde x = \begin{cases} x_{((n+1)/2)} & n \text{ odd} \\ \tfrac12\left(x_{(n/2)} + x_{(n/2+1)}\right) & n \text{ even} \end{cases}
$$

## Ví dụ có lời giải

### Quiz scores (default)

- Data: 85, 92, 78, 92, 88, 76, 95, 81, 92, 70
- **Mean (average): 84.9**
- **Median: 86.5**
- **Mode: 92 (appears 3 times)**
- **Range: 25**
- **Count: 10**
- **Sum: 849**
- **Minimum: 70**
- **Maximum: 95**
- **Mean as a fraction: 849/10 = 84 9/10**
- Nguồn đối chiếu: Python 3.8 statistics.mean = 84.9, statistics.median = 86.5, statistics.multimode = [92]; sum 849

### calculator.net example, two modes

- Data: 10, 2, 38, 23, 38, 23, 21
- **Mean (average): 22.143**
- **Median: 23**
- **Mode: 23 and 38 (each appears twice)**
- **Range: 36**
- **Sum: 155**
- **Mean as a fraction: 155/7 = 22 1/7**
- Nguồn đối chiếu: calculator.net mean, median, mode, range calculator worked example: mean 22.143, median 23, modes 23 and 38, range 36

### Calculator Soup example, 16 values

- Data: 9, 10, 12, 13, 13, 13, 15, 15, 16, 16, 18, 22, 23, 24, 24, 25
- **Mean (average): 16.75**
- **Median: 15.5**
- **Mode: 13 (appears 3 times)**
- **Range: 16**
- **Count: 16**
- **Sum: 268**
- **Minimum: 9**
- **Maximum: 25**
- Nguồn đối chiếu: Calculator Soup mean, median, mode calculator example output: mean 16.75, median 15.5, mode 13, range 16, count 16, sum 268

### NIST StRD NumAcc1

- Data: 10000001, 10000003, 10000002
- **Mean (average): 10,000,002**
- **Median: 10,000,002**
- **Mode: No mode (every value appears once)**
- **Range: 2**
- **Mean as a fraction: không áp dụng**
- Nguồn đối chiếu: NIST StRD NumAcc1 certified mean 10000002; median and range by hand from the sorted values 10000001, 10000002, 10000003

### Every value twice: no mode (edge case)

- Data: 1, 1, 2, 2
- **Mean (average): 1.5**
- **Median: 1.5**
- **Mode: No mode (every value appears twice)**
- **Range: 1**
- Nguồn đối chiếu: Calculator Soup convention: if all numbers occur the same number of times there is no mode; mean 6/4 and median (1 + 2)/2 by hand

### Single value

- Data: -4.5
- **Mean (average): -4.5**
- **Median: -4.5**
- **Mode: −4.5 (appears once)**
- **Range: 0**
- **Count: 1**
- Nguồn đối chiếu: Definitions (NIST e-Handbook §1.3.5.1): with one value the mean, median and mode equal it and the range is 0

## Câu hỏi

### How do you find the mean, median and mode?

Add the values and divide by the count for the mean: 10, 2, 38, 23, 38, 23, 21 sum to 155, and 155 ÷ 7 = 22.14. Sort them (2, 10, 21, 23, 23, 38, 38) and take the middle one, the 4th, for the median: 23. Count repeats for the mode: 23 and 38 each appear twice, so both are modes. The range is 38 − 2 = 36.

### How do you find the median of an even number of values?

Sort the values and average the two in the middle, at positions n ÷ 2 and n ÷ 2 + 1. For the 16 values 9, 10, 12, 13, 13, 13, 15, 15, 16, 16, 18, 22, 23, 24, 24, 25, the 8th and 9th are 15 and 16, so the median is 15.5. This is the definition in the NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.1.

### Can a data set have more than one mode or no mode?

Yes to both. NIST notes that the mode is not necessarily unique: 2, 3, 3, 5, 5, 8 has two modes, 3 and 5, and is called bimodal. When every value appears the same number of times, as in 4, 7, 9 or 1, 1, 2, 2, no value occurs more often than the others and the data have no mode.

### Which average should I use: mean, median or mode?

Use the mean for roughly symmetric data without extreme values, the median when a few values are far from the rest, and the mode for categories or the most common size. One outlier moves the mean but not the median: for 3, 4, 5 the mean and median are both 4, but changing 5 to 50 lifts the mean to 19 while the median stays 4.

### What is the difference between average and mean?

In everyday use "average" means the arithmetic mean, the sum divided by the count, and spreadsheet functions follow that: Excel's AVERAGE returns the mean. In statistics "average" is a looser word for any measure of center, so the median and mode are also called averages. When a report says "average" without saying which, it is almost always the mean.

### “Máy tính trung bình, trung vị và mốt” chính xác đến mức nào?

Độ chính xác phụ thuộc vào dữ liệu nhập và giả định của phương pháp. Phép tính thập phân dùng 50 chữ số có nghĩa, nhưng ước lượng, phương pháp số và dữ liệu nguồn có thể kém chính xác hơn; làm tròn khi hiển thị không loại bỏ các giới hạn đó. Ví dụ có lời giải đã đối chiếu với nguồn độc lập: 6. Ví dụ, “Quiz scores (default)” được kiểm tra bằng Python 3.8 statistics.mean = 84.9, statistics.median = 86.5, statistics.multimode = [92]; sum 849.

### Phương pháp này lấy từ đâu?

NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.1 Measures of location (mean, median, mode); NIST Statistical Reference Datasets: univariate summary statistics (NumAcc1); Python statistics module: mean, median, multimode.

## Nguồn

- [NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.1 Measures of location (mean, median, mode)](https://www.itl.nist.gov/div898/handbook/eda/section3/eda351.htm)
- [NIST Statistical Reference Datasets: univariate summary statistics (NumAcc1)](https://www.itl.nist.gov/div898/strd/univ/homepage.html)
- [Python statistics module: mean, median, multimode](https://docs.python.org/3/library/statistics.html)
