Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I put multiple qreg function lines and the x and ys on the same graph?

    For example, I have a set of data x and y.
    I now regress y=a+bx for 20th, 30th, 40th percentile of y.
    After that I hope to get a graph with the 3 regression lines and all the original x and ys.
    What should the codes be for that?

  • #2
    Hi Jilae
    For a simple example like the one you describe, the following may help:
    Code:
     use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
     
    foreach i in 10 25 50 75 90 { 
    qreg lnwage c.age##c.age##c.age, q(`i')
    predict ln_wage_`i'
    label var  ln_wage_`i' "Ln wages q`i'Hat"
    }
    
    two scatter lnwage age, msize(tiny) || line ln_wage_* age, sort
    HTH

    Comment

    Working...
    X