Dear All,
Hello. I am creating a scatter plot and lfit by using the below code. Then I get the plot below the code.

As you can see, the lfit line goes below the y-axis value of 0, so the y-axis doesn’t meet the x-axis. I want the lfit line to be plotted only between the y-axis values of 0 and 1.
This dataset is US county-level. Variable y is not affected by the county population size. But the variable x is seriously affected by the population size and has a large variation. (min = 0, max = 825.4105)
Therefore, I used variable 'x_normalized' which is defined by x/population in the above code and plot. I think I fully addressed the problem of population size, but the y-axis problem in the plot occurs whether I use x or x_normalized.
How can I address the problem of lfit going out of y-axis range?
Thank you for your help.
p.s. If I omit the observations with the top 10% x value or assign weights based on the county population, the problem does not occur.
Hello. I am creating a scatter plot and lfit by using the below code. Then I get the plot below the code.
Code:
twoway (scatter y x_normalized, msymbol(oh) (lfit y x_normalized), legend(off) scheme(white_tableau) ylabel(0(0.2)1)
As you can see, the lfit line goes below the y-axis value of 0, so the y-axis doesn’t meet the x-axis. I want the lfit line to be plotted only between the y-axis values of 0 and 1.
This dataset is US county-level. Variable y is not affected by the county population size. But the variable x is seriously affected by the population size and has a large variation. (min = 0, max = 825.4105)
Therefore, I used variable 'x_normalized' which is defined by x/population in the above code and plot. I think I fully addressed the problem of population size, but the y-axis problem in the plot occurs whether I use x or x_normalized.
How can I address the problem of lfit going out of y-axis range?
Thank you for your help.
p.s. If I omit the observations with the top 10% x value or assign weights based on the county population, the problem does not occur.

Comment