# Non monotonic relationship between two variables

### Majestic Beginners Guide to Correlation: Part 5 -Majestic Blog

In linear regression analysis, it's an important assumption that there should be a linear relationship between independent variable and dependent variable. How do I check for non-linear and non-monotonic effect between variables in that the bivariate scatterplot suggests a parabolic (i.e. quadratic) relationship; then . Analysis of two independent samples using stata software: Non- parametric. o Monotonic The general direction of a relationship between two variables is known Can be increasing or decreasing o Used for interval or ratio variables.

Consider two datasets X and Y shown in the table in Figure 5, and graphically displayed in Figure 6 a. Plots of a Original values and b Ranks Note that X and Y have a strictly monotonically increasing relationship.

The first step is to calculate the rank of each element of X, i. This is shown in the fourth column labelled Rank X in Figure 5. Once all the elements of X have been ranked, the exact procedure is applied to the elements in dataset Y, and the values are shown in the fifth column labelled Rank Y. Observe that although the association between the data points of X and Y is nonlinear, the points on the plot of Rank Y versus Rank X all lie on a straight line as shown in Figure 6 bindicating a perfect correlation.

In fact, if we calculate the Pearson correlation coefficient between the original values of the datasets X and Y using the method described in Part 4we obtain a value of 0. But what about the case when the two datasets are not strictly monotonic or have duplicate repeated or tied ranks?

### Detect Non-Linear and Non- Monotonic Relationship between Variables

Again, let us look at an example. Two datasets X and Y are displayed in the table in Figure 7. The corresponding plots are in Figure 8. Note the monotonic trend of the data as shown by the red line. Plots of a Original Values and b Modified Ranks Look carefully at the three values of the dataset Y that have equal values of 3.

Notice their joint modified rank of 6 in the sixth column. We do this as, in this example, we have no way of knowing which score should be put in rank 5, 6 and which score should be ranked 7. Figure 8 b shows that the scatter plot of Rank X versus Modified Rank Y no longer forms a straight line, although the level of association still remains high.

In fact, the Spearman coefficient has a higher value than the Pearson coefficient.

## Majestic Beginners Guide to Correlation: Part 5

In the case of distinct ranks without ties, a general formula exists for the calculation of rs. The points in Plot 1 follow the line closely, suggesting that the relationship between the variables is strong. When one variable increases while the other variable decreases, a negative linear relationship exists.

The points in Plot 2 follow the line closely, suggesting that the relationship between the variables is strong. Weak linear relationship Plot 4: Nonlinear relationship The data points in Plot 3 appear to be randomly distributed. They do not fall close to the line indicating a very weak relationship if one exists.

**Continuity of Function in hindi (Lecture 1)**

If a relationship between two variables is not linear, the rate of increase or decrease can change as one variable changes, causing a "curved pattern" in the data. This curved trend might be better modeled by a nonlinear function, such as a quadratic or cubic function, or be transformed to make it linear.

## Spearman's Rank-Order Correlation

Spearman's correlation measures the strength and direction of monotonic association between two variables. Monotonicity is "less restrictive" than that of a linear relationship.

For example, the middle image above shows a relationship that is monotonic, but not linear. A monotonic relationship is not strictly an assumption of Spearman's correlation. That is, you can run a Spearman's correlation on a non-monotonic relationship to determine if there is a monotonic component to the association. However, you would normally pick a measure of association, such as Spearman's correlation, that fits the pattern of the observed data.

That is, if a scatterplot shows that the relationship between your two variables looks monotonic you would run a Spearman's correlation because this will then measure the strength and direction of this monotonic relationship.