简体   繁体   中英

how to compare slopes linear regression

How to compare the slope of multiple regressions?

在此处输入图像描述

As you can see the slope is not comparable. The slope in graphic 3 is clearly flatter than graphic 1 but the slope value is much higher.

Or is there a better measure for the steepness of the line?

The slope of linear regression is exactly what it is supposed to be.

y=mx+c

The m slope gives the steepness of the regression line. There is no "better measure for the steepness of the line". This should be clear with the mathematics behind the equation of a straight line.


The issue you are facing here is that of axis scaling. Each of your above charts has a different y-axis scale. It's obvious why you are unable to visually compare the slopes of your regression lines. You are comparing apples to oranges in this case. If you visually compare a line drawn in different y ranges then you end up misinterpreting what the slope is.

In short, You are visually comparing the slope between chart 1 which has y-axis from 14750 to 16500 against the slope of chart 3 which ranges from 4000 to 18000 which doesn't make any sense. It's like comparing apples to oranges

You need to fix the x and y-axis ranges (set them to a fixed value, say 0-20000) for y-axis and then you should be able to see that the slope values are exactly comparable and visually intuitive.

Use the following to set axis limits -

plt.xlim(0, 175)
plt.ylim(0, 20000)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM