In this tutorial we will explore how to calculate kurtosis in Python.
Table of contents:
- What is kurtosis?
- How to calculate kurtosis?
- How to calculate kurtosis in Python?
Kurtosis is mainly a measure of describing the shape of a probability distribution and specifically its “tailedness”.
The calculated statistic evaluates how thick or thin the tails of a given probability distribution are compared to the normal distribution.
Where skewness focuses on the differentiating the tails of the distribution based on the extreme values (or simply the symmetry of the tails), kurtosis measures whether there are extreme values in either of the tails (or simply if the tails are heavy or light).
To continue following this tutorial we will need the following Python library: scipy.
If you don’t have it installed, please open “Command Prompt” (on Windows) and install it using the following code:
pip install scipy
What is kurtosis?
In statistics, kurtosis is a measure of relative peakedness of a probability distribution, or alternatively how heavy or how light its tails are. A value of kurtosis describes how different the tails of a given probability distribution are from a normal distribution.
Kurtosis can take several values:
- Positive excess kurtosis — when excess kurtosis, given by (kurtosis-3), is positive, then the distribution has a sharp peak and is called a leptokurtic distribution.
- Negative excess kurtosis — when excess kurtosis, given by (kurtosis-3), is negative, then the distribution has a flat peak and is called a platykurtic distribution.
- Zero excess kurtosis — when excess kurtosis, given by (kurtosis-3), is zero, then the distribution follows a normal distribution and is also called a mesokurtic distribution.
Here is a summary of what is mentioned above in a table format:
How to calculate kurtosis?
The measure of kurtosis is calculated as the fourth standardized moment of a distribution.
Sounds a bit complicated? Follow the next steps to have a complete understanding of the calculations.
The kth moment of the distribution can be calculated as:
As mentioned before, skewness is the fourth moment of the distribution and can be calculated as:
and knowing that the…
Continue reading: https://towardsdatascience.com/calculate-kurtosis-in-python-with-examples-pyshark-2b960301393?source=rss—-7f60cf5620c9—4