This calculator helps you analyze the central tendency of your data distribution. It calculates the arithmetic mean (average), median (middle value), and mode (most frequent value), helping you understand the typical values and patterns in your dataset. It also provides a histogram with the mean, median, and mode marked for easy visualization if a numeric column is selected. A bar chart is also provided to visualize the frequency distribution of a categorical column.
Quick Calculator
Need a quick calculation? Enter your numbers below:
Calculator
1. Load Your Data
2. Select Columns & Options
Learn More
Mean (Arithmetic Mean)
Definition
The arithmetic average of all values, representing the central tendency of the data.
Formula
Example
For the numbers:
Key Points
- Sensitive to extreme values (outliers)
- Best used when data is symmetrically distributed
Comparison of Different Means
Important Relationship:
For any set of positive numbers:
(Equality occurs only when all numbers are the same)
Type | Formula | Example |
---|---|---|
Arithmetic Mean | ||
Geometric Mean | ||
Harmonic Mean |
Arithmetic Mean(Current)
Best For:
- Simple averages of quantities
- Calculating central tendency
- Equal weight to all values
- Linear relationships
Common Uses:
- Test scores
- Heights/weights
- Daily temperatures
- Income levels
Limitations:
- Sensitive to outliers
- Not ideal for ratios or rates
Geometric Mean
Best For:
- Growth rates
- Percentage changes
- Ratios and proportions
- Exponential relationships
Common Uses:
- Investment returns
- Population growth
- Interest rates
- Price indices
Limitations:
- Only works with positive numbers
- More complex calculation
Harmonic Mean
Best For:
- Rates and speeds
- Per-unit quantities
- Reciprocal relationships
- Density measurements
Common Uses:
- Average speed over different distances
- Price per unit calculations
- Density measurements
- Circuit calculations (parallel resistors)
Limitations:
- Only works with positive numbers
- Gives more weight to smaller values
When to Use Each Mean
Use Arithmetic Mean when you need a simple average and all values should have equal weight
Use Geometric Mean when dealing with growth rates, returns, or multiplicative changes
Use Harmonic Mean when working with rates, speeds, or other measures where using reciprocals makes sense
Median
Definition
The middle value in a sorted set of numbers. For an even number of values, it's the average of the two middle numbers.
Formula
Example
For odd number of values:
For even number of values:
Key Points
- Not affected by extreme values (outliers)
- Best used when data is skewed or contains outliers
Mode
Definition
The most frequently occurring value(s) in a set of numbers. A dataset can have no mode, one mode, or multiple modes.
Formula
Example
For the numbers with multiple modes:
Because 2 and 4 each appear twice, more than any other number
For numbers , there is no mode because all numbers appear exactly once.
Key Points
- Can have multiple modes (bimodal, trimodal, etc.) or no mode
- Particularly useful for categorical data and discrete numerical data
Calculating Mean, Median, and Mode from a Bar Chart
Mean Calculation
1. Multiply each value by its frequency:
4 × 2 = 8
6 × 3 = 18
8 × 2 = 16
10 × 1 = 10
2. Sum all products: 2 + 8 + 18 + 16 + 10 = 54
3. Sum all frequencies: 1 + 2 + 3 + 2 + 1 = 9
4. Divide: 54 ÷ 9 = 6
Mean = 6
Median Calculation
1. List all values (including duplicates):
2. Find middle position: (n+1) ÷ 2 = (9+1) ÷ 2 = 5th
3. Find 5th value in ordered list
Median = 6
Mode Calculation
1. Count frequency of each value:
4: occurs 2 times
6: occurs 3 times
8: occurs 2 times
10: occurs 1 time
2. Find highest frequency (3)
3. Identify value(s) with that frequency
Mode = 6
Final Results:
Creating Frequency Tables in R
Here is an example of how to calculate the mean, median, and mode of a dataset in R using the tidyverse package.
library(tidyverse)
tips <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/tips.csv")
central_measures <- tips |>
summarise(
mean_tip = mean(tip), # 2.9983
median_tip = median(tip) # 2.9
)
day_counts <- table(tips$day)
mode_days <- names(day_counts[day_counts == max(day_counts)]) # Sat
# histogram of tip with mean, median vertical lines
ggplot(tips, aes(x = tip)) +
geom_histogram(binwidth = 0.5, fill = "darkblue", alpha = 0.7) +
geom_vline(aes(xintercept = central_measures$mean_tip, color = "Mean"),
linetype = "dashed", linewidth = 1) +
geom_vline(aes(xintercept = central_measures$median_tip, color = "Median"),
linetype = "dotted", linewidth = 1) +
scale_color_manual(name = "Statistics",
values = c("Mean" = "red", "Median" = "green")) +
labs(title = "Distribution of Tip Amounts",
x = "Tip Amount ($)",
y = "Frequency") +
theme_minimal() +
theme(legend.position = "bottom")
# bar chart of day frequencies
day_freq <- tips |>
count(day) |>
arrange(desc(n))
# bar chart with calculated frequencies
ggplot(day_freq, aes(x = reorder(day, -n), y = n)) +
geom_bar(stat = "identity", fill = "steelblue", width = 0.6) +
geom_text(aes(label = n), vjust = -0.5, size = 3.5) +
labs(title = "Frequency of Restaurant Visits by Day",
x = "Day of Week",
y = "Number of Visits") +
theme_minimal()
Related Calculators
Help us improve
Found an error or have a suggestion? Let us know!