Announcement

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

  • how to graph plot that contains multiple lines

    Dear all,

    I'm a Stata beginner.

    I've graphed four quantile regression plots (1997,2002,2007, and 2012 years),and I want to graph a plot that contains four quantile regression lines in one plot.

    But have no idea what code should I write.

    How should I write the code to graph the four quantile regression line in one plot?



    Thanks for any help. Sun
    Last edited by TingYu Sun; 06 May 2016, 06:06.

  • #2
    You don't give the syntax you use to fit and plot results from the quantile regression for each year.

    In principle, you should use predict to save predictions from each regression in new variables. Then presumably you show data with scatter and predictions with line calls.

    Comment


    • #3
      Dear Nick

      I use -qreg- and -grqreg- to analyze and graph the plot.

      Comment


      • #4
        I guessed that, but if you want more detailed advice, you will need to say much more. See http://www.statalist.org/forums/help#stata

        Comment


        • #5
          dear Nick,

          sorry for the unclearly information,I use -qreg- and -grqreg- to analyze and graph the plot in STATA 12.1. The following are my commands:

          qreg ln_drug age male inpatient_day if year==2012,quant(.5)
          grqreg age,ci


          The result of the plot is the form of attachment FIG 1, but i've no idea how to graph the plot like FIG 2.




          Sun
          Attached Files
          Last edited by TingYu Sun; 06 May 2016, 07:53.

          Comment


          • #6
            Sorry. I can't add to my previous posts. I can't relate your Figure 2 to anything in your data.

            Comment


            • #7
              Dear Nick,

              I've uploaded the newest figure in the attachment.

              Both fig1 and 2 are quantile plot.

              Comment


              • #8
                I assume you want to run qreg over multiple years and graph the results of each year in a single grqreg graph. grqreg (available from SSC) does not appear to have a by() option. You may be able to construct such a graph on your own with the commands Nick Cox suggests in #2.
                Stata/MP 14.1 (64-bit x86-64)
                Revision 19 May 2016
                Win 8.1

                Comment

                Working...
                X