Announcement

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

  • Adding Number of Observations and R-square to Marginsplot

    Hello everyone,
    Is there any way to add the number of observations and R2 values into the marginsplot command to have plots with these values?
    Thank you,
    Mahmut

  • #2
    margins allows twoway options, so use the any number of ways to include text in a twoway graph, e.g.,

    Code:
    webuse nhanes2, clear
    regress bpsystol agegrp##sex
    margins agegrp
     marginsplot, plotopts(text(140 3 "{it:R}{sup:2} = `:di %3.1f e(r2)'")  ///
     text(143 3.12 "{it:N} = `:di %5.0f e(N)'")) scheme(s1mono)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	34.2 KB
ID:	1677778

    Comment


    • #3
      Thank you so much

      Comment

      Working...
      X