
Image by Editor | ChatGPT
Understanding the shape of your data is an essential part of data analysis. Two useful measures that describe this shape are skewness and kurtosis. Skewness tells you if the data is lopsided or symmetrical. Kurtosis shows how heavy or light the tails of the distribution are.
These values help you know if your data follows a normal distribution or not. Skewness and kurtosis can be calculated as numbers, but visualizing them enables you to understand the data better. In R, there are several packages to plot these properties.
In this article, you will learn how to visualize skewness and kurtosis in R.
What Are Skewness and Kurtosis?
Skewness measures the asymmetry of the distribution.
- Positive skew (Right-skewed): The tail on the right side of the distribution is longer.
- Negative skew (Left-skewed): The tail on the left side is longer.
- Zero skew: The distribution is perfectly symmetrical (like the normal distribution).
Kurtosis measures the “tailedness” or peakedness of a distribution.
- High kurtosis (leptokurtic): Distributions with heavy tails and a sharper peak than the normal distribution.
- Low kurtosis (platykurtic): Distributions with light tails and a flatter peak compared to a normal distribution.
- Normal kurtosis (mesokurtic): The kurtosis of the normal distribution.
Getting Started in R
Load Required Libraries
We will use a few popular R packages:
install.packages(c("e1071", "ggplot2"))
library(e1071) # for skewness and kurtosis
library(ggplot2) # for visualization
Calculating Skewness and Kurtosis
Let’s load the mtcars dataset and compute the skewness and kurtosis for the mpg variable:
data(mtcars)
skew_mpg <- skewness(mtcars$mpg)
kurt_mpg <- kurtosis(mtcars$mpg)
cat("Skewness of mpg:", round(skew_mpg, 3), "\n")
cat("Kurtosis of mpg:", round(kurt_mpg, 3), "\n")
Skewness of mpg: 0.64 Kurtosis of mpg: 2.799
Visualizing Skewness and Kurtosis
Histogram with Density Curve
Histograms show how often different values appear in the data. The overlaid density curve helps us see the overall shape of the data more clearly.
ggplot(mtcars, aes(x = mpg)) +
geom_histogram(aes(y = ..density..), bins = 15, fill = "skyblue", color = "black", alpha = 0.7) +
geom_density(color = "blue", size = 1) +
geom_vline(aes(xintercept = mean(mpg)), color = "red", linetype = "dashed") +
labs(title = "Histogram and Density of mpg",
subtitle = paste("Skewness:", round(skew_mpg, 3), "| Kurtosis:", round(kurt_mpg, 3)),
x = "Miles per Gallon (mpg)", y = "Density")

Key Observations:
- A right-skewed histogram will have a longer tail to the right.
- A left-skewed histogram will stretch more to the left.
- A symmetric histogram will show a balanced bell shape.
Q-Q Plot
A Q-Q plot (Quantile-Quantile plot) compares two probability distributions. It helps to see if data follows a specific distribution, like a normal distribution.
qqnorm(mtcars$mpg, main = "Q-Q Plot of mpg") qqline(mtcars$mpg, col = "red", lwd = 2)

Key Observations:
- If points deviate from the line in the tails, the data likely has high or low kurtosis.
- A straight line shows normality.
Boxplot
Boxplots summarize the spread and skewness of the data. The length of the whiskers and the number of outliers show kurtosis.
boxplot(mtcars$mpg, horizontal = TRUE, col = "lightgreen",
main = "Boxplot of mpg", xlab = "Miles per Gallon (mpg)")

Key Observations:
- Skewness is indicated if the median line is not centred or one whisker is longer.
- Kurtosis can be noticed if there are many outliers or if the outliers are very far from the rest of the data.
Conclusion
Skewness tells us about the asymmetry of a distribution. Positive skew means a longer right tail, negative skew means a longer left tail, and zero skew suggests symmetry.
Kurtosis describes the shape of the tails and the peak. High kurtosis means heavy tails and a sharp peak, while low kurtosis means light tails and a flat peak.
Visualizations like histograms, Q-Q plots, and boxplots help us understand skewness and kurtosis in data. These insights are essential for selecting appropriate statistical methods and interpreting data correctly.

Kurtosis tells nothing about the peak. High kurtosis distributions can be low and flat-topped, and low kurtosis distributions can be infinitely peaked. Please see https://stats.stackexchange.com/q/659400/102879
Thank you Peter! We appreciate your feedback on this subject.