Announcement

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

  • Scatter plot with linear fit of two-period independent variable and one dependent variable.


    Dear All,
    I've data on y for period 1 and data on x for periods 4 and 5.

    I want to graphically depict this using the
    HTML Code:
    aaplot
    command. Possible and any lead?

    Thanks,
    Dapel
    Last edited by Zuhumnan Dapel; 16 Oct 2019, 18:05.

  • #2
    aaplot is from SSC as you are asked to explain (FAQ Advice #12).

    Otherwise -- particularly without a data example (see same place in FAQ Advice) -- I have no clear idea what you want. Perhaps it's


    Code:
    scatter x period if period == 1 | scatter y period if inlist(period, 4, 5)
    I am guessing wildly. Is this panel data?

    Comment


    • #3
      Thanks! Not really a panel. I've got Xi1, Xi2 and Yi1. It's pretty straight forward to depict the relationship between Xi1 and Yi1. But what if I want to add a best fit of Xi2 to the graph?

      Comment


      • #4
        Still no data example. I hesitate to ask this after you've posted 346 times here but are you aware of the request to read and act on http://www.statalist.org/forums/help ?

        I am still guessing and your language and your notation seem at odds too, but

        Code:
        scatter Yi1 Xi1 || scatter Yi1 Xi2 || lfit Yi1 Xi1 || lfit Yi1 Xi2
        may give you some ideas. No more from me.

        Comment


        • #5
          You've done me a world of good. Thanks a million! The last code you posted gave me exactly what I'm looking for.

          Thanks again,
          Dapel

          P.S.

          I used
          Code:
          clear
          
          . set obs 20
          obs was 0, now 20
          
          . generate randnum = uniform()
          
          . generate y = uniform()
          
          . generate yi1 = uniform()
          
          . generate xi1 = uniform()
          
          . generate xi2 = uniform()
          
          . scatter yi1 xi1 || scatter yi1 xi2 || lfit yi1 xi1 || lfit yi1 xi2

          Comment

          Working...
          X