Plotting Quantile Regression Lines
Asked Answered
H

1

5

In Stata, is it possible to plot quantile regression lines? I know a standard OLS regression line can be added to a scatter plot but it isn't clear to me how to add other types of regression lines.

If that is not possible is, it possible to plot a line that I specify in the mx+b format? Then I could just take the slope and intercept terms from the quantile regression output and plot them manually.

Thanks for the help!

Hann answered 10/12, 2012 at 19:10 Comment(0)
U
10

Yes. Specifically, you can save the fitted values after model fitting, after which you plot those predicted values as an extra variable. Generally, twoway function allows plotting lines and curves given their formulas. I'll not illustrate the second method given the first.


. sysuse auto
(1978 Automobile Data)

. gen gpm = 1/mpg

. qreg gpm weight

 

. predict predicted
(option xb assumed; fitted values)

. scatter gpm weight || line predicted weight, sort ytitle("1 / `: var label mpg'") legend(off)

Unguentum answered 12/12, 2012 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.