Announcement

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

  • How to combine two graphs obtain using grqreg?

    Dear user, First, I did regression for rural using "qreg", then, i obtain quantile graph using grqreg. Second, I did regression for urban, then, i obtain quantile graph using grqreg. Now, I want to combine rural and urban quantile graph in one graph. But, unable to do. Please suggest me how to write code in shortest way. You can use auto data.

  • #2
    Use the save() option in grqreg, merge the files and then graph using twoway.

    Comment


    • #3
      Thank you Scott. But what variable need to be used as the key variable during merge. Is it 'qtile' or something else?

      Comment


      • #4
        Yes

        Code:
        clear
        sysuse auto
        qreg price mpg if fore == 0
        grqreg mpg, save(q1)
        qreg price mpg if fore == 1
        grqreg mpg, save(q2)
        use q1
        rename mpg DomesticMPG
        label var DomesticMPG "Domestic MPG"
        merge 1:1 qtile using q2
        rename mpg ForeignMPG
        label var ForeignMPG "Foreign MPG"
        line D F qt
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	31.2 KB
ID:	1448322

        Comment


        • #5
          Thank you Scott.

          Comment

          Working...
          X