Announcement

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

  • Margins plots curve lines other than straight line

    After using "margins" command, I use "marginsplot" command to graph the margins plots. I get straight line while I find in some other papers, they present curve. How can I get curves other than straight lines?

    The graph I get like this:

    Click image for larger version

Name:	graph.png
Views:	2
Size:	32.0 KB
ID:	1711545


    The graph in other papers like this:


    Thanks.
    Attached Files

  • #2
    Originally posted by Vill Wang View Post
    After using "margins" command, I use "marginsplot" command . . . I get straight line while I find in some other papers, they present curve. How can I get curves other than straight lines?
    Add a polynomial or spline interaction to the model.
    Code:
    sysuse auto
    
    // Straight lines
    regress price i.foreign##c.mpg
    margins foreign, at(mpg = (10 15 20 25 30 35 40))
    marginsplot
    
    // Curves
    regress price i.foreign##c.mpg##c.mpg
    margins foreign, at(mpg = (10 15 20 25 30 35 40))
    marginsplot

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      Add a polynomial or spline interaction to the model.
      Code:
      sysuse auto
      
      // Straight lines
      regress price i.foreign##c.mpg
      margins foreign, at(mpg = (10 15 20 25 30 35 40))
      marginsplot
      
      // Curves
      regress price i.foreign##c.mpg##c.mpg
      margins foreign, at(mpg = (10 15 20 25 30 35 40))
      marginsplot

      Thanks a lot for your generous help!

      When I use command

      xi: probit y x $controla , vce (cluster StockName1)

      I get the plot like this:


      Click image for larger version

Name:	_20230428165457.png
Views:	1
Size:	33.9 KB
ID:	1711558

      However, other papers' plots are curve.
      Click image for larger version

Name:	_20230428170056.png
Views:	1
Size:	44.6 KB
ID:	1711559

      Thanks

      Comment


      • #4
        A quick-and-dirty example:
        Code:
        sysuse auto
        probit foreign c.mpg
        
        // Curved
        margins , at(mpg = (10(10)40))
        marginsplot
        
        // Straight
        margins , at(mpg = (0(0.001)0.004))
        marginsplot
        Depending upon where you are, you can get a straight-seeming line or an curved line with marginsplot after margins with the default (probability) predictions after probit, logit.

        Comment


        • #5
          [QUOTE]
          A quick-and-dirty example:
          Code:
          sysuse auto probit foreign c.mpg // Curved margins , at(mpg = (10(10)40)) marginsplot // Straight margins , at(mpg = (0(0.001)0.004)) marginsplot
          Depending upon where you are, you can get a straight-seeming line or an curved line with marginsplot after margins with the default (probability) predictions after probit, logit.


          Thanks a lot for your help!

          Comment

          Working...
          X