Data Science

Monotonic Relationship

Various relationships between multiple variables might help us gain additional insight from our data in mathematics. In general, the relationships can be growing, linear, or declining. Various tests are also applied to measure these relationships between variables. We will look at the monotonic relationship between two variables and how to test it.

What is Covariance?

Covariance is a statistic that examines how two random variables change together and measure their relationship. The difference between variance and covariance is that variance measures the variation of one variable, whereas covariance measures the variation of two variables in relation to each other. We can also say, variance exposes a variable’s covariance with itself. The direction of association between two variables is determined by covariance, ranging from (-) infinity to (+) infinity.

What is Correlation?

Correlation is a scaled measure of covariance used to decide the capability of a link between two variables. The correlation coefficient is a one-dimensional statistic with a range of (-1) to (+1). (-1) indicates a strong negative association between two variables, whereas (+1) indicates a strong positive relationship.

What is a Monotonic Relationship?

In case one variable increases in tandem with another, or the value of one variable increases, the value of the other variable goes down; there is a monotonic relationship between the two variables. The rate at which a rise or reduction happens does not have to be the same for both variables. A monotonic relationship can be a linear relationship in which both variables increase or decrease at the same rate. The below plot shows how one variable increases with the other. This is called the positive monotonic relation.

The below plot shows the negative monotonic correlation where one variable decreases with another.

Strictly Monotonic vs. Non-Strictly Monotonic

If the delta of one variable is always connected with the delta in the same direction in the other variable, the connection is said to be strictly monotonic. For example, when one variable rises, the other rises with it, and the other falls when one variable falls. In a simple monotonic connection, on the other hand, two variables can be the same at some point.

Quantifying Monotonic Relationship using Spearman’s Rank Correlation Coefficient

Spearman’s rank correlation coefficient shows how two variables are in relation. It essentially provides a measure of the monotonicity of a connection between two variables, i.e., efficiently, a monotonic function can elaborate the relation between two variables. The spearman constant has a range of -1 to +1, both inclusive. Absolutely monotone functions could express the relationship between the two variables if the value is +1 or -1. To calculate the value of Spearman’s coefficient, first, convert the raw data into ranked data for both variables X and Y, then use the following formula to the ranked variables.


We went over several terms related to monotonic relationships in this article. Covariance measures how closely two or more variables are related, and its value can be any real number. Another way to measure a relationship is to use correlation. When one variable increases or decreases in response to an increase in another variable, this is known as a monotonic relationship. The monotonic relationship between the variables is measured using Spearman’s rank correlation coefficient, which is commonly used.

About the author

Simran Kaur

Simran works as a technical writer. The graduate in MS Computer Science from the well known CS hub, aka Silicon Valley, is also an editor of the website. She enjoys writing about any tech topic, including programming, algorithms, cloud, data science, and AI. Travelling, sketching, and gardening are the hobbies that interest her.