Announcement

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

  • Twoway Scatter - Plot difference of two variables with unique id

    Hi everyone,

    The twoway scatter plot below shows two different valuation estimates on individual level. Hence, for each individual (x-axis) there is a WTA (blue dots) and a WTP (red dots) estimate.
    Now my question. I have been trying to connect the blue dots and red dots on individual level to show the difference between WTA and WTP estimates. Ideally, this would just add a thin vertical connection line between each (individual) pair of red and blue dots. Important: I don't want to make a line plot. I want to illustrate the difference for each individual WTA and WTP valuation.

    Can someone help me with that'

    Best regards, Gian

    example.png

  • #2
    Perhaps

    Code:
    twoway rspike WTA WTP id
    I'd recommend a log scale, assuming no prices are zero.

    Unless id is inherently informative, it is unlikely to provide the best sort order.

    Comment


    • #3
      Excellent, that worked perfectly fine. Thank you Nick!

      Comment


      • #4
        The x-axis contains no useful information; it is just an ID. If you try scatter WTA WTP (probably with log scales) you might get a cleaner representation of the same information.
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          More at https://www.stata-journal.com/sjpdf....iclenum=gr0041

          Comment

          Working...
          X