Announcement

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

  • binscatter and multiple linetypes possible

    Hi all--I am wondering if there is a way to plot both a linear and quadratic line on my scatters. When I try one or the other, it works fine, but it doesn't seem to work with both. Maybe my syntax is wrong or maybe there is a more creative way to do this . . . does anyone have advice? (Also, I realize I can make this work with scatter, but I have too many points, so I've been using binscatter.)

    WORKS:
    Code:
     binscatter resid prop_same, nquantiles(100) line(qfit)
    DOESN'T WORK:
    Code:
     binscatter resid prop_same, nquantiles(100) line(lfit) line(qfit)
    DOESN'T WORK:
    Code:
     binscatter resid prop_same, nquantiles(100) line(lfit qfit)

  • #2
    binscatter is from SSC, as you are asked to explain (FAQ Advice #12)As I understand it, you need to choose one linetype.

    Comment


    • #3
      use the -savedata()- option, then import the data, and call:

      Code:
      scatter resid prop_same  || lfit resid prop_same || qfit resid prop_same

      Comment


      • #4
        I don't understand the advantage here of binscatter over just calling up lfit and/or qfit directly. So far as I can see binscatter bins the data and allows data-driven summaries -- which is more than fine by me, and I did something loosely similar way back in binsm (STB/SJ) -- but linear and quadratic fits that ignore within-bin variation are not so appealing.
        Last edited by Nick Cox; 08 Feb 2020, 02:38.

        Comment

        Working...
        X