Announcement

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

  • Plot coefficient and s.e. for different variable in different regressions (coefplot)?

    Hi!

    I am running the same regressions while changing the thresholds for a dummy variable included in these regressions.

    example:
    reg y x dummy01
    reg y x dummy02
    reg y x dummy 03

    I would like to have a graph of the different coefficients for the dummies with standard errors from each of the regressions but have the value of the threshold 01 02 03 on the x axis.

    Essentially, I would like something like this below, but with each dot being from different regressions and the X-axis informing on the threshold I am using.

  • #2
    coefplot is from SSC (FAQ Advice #12). The example below additionally uses estout from SSC.

    Code:
    clear
    set seed 10142021
    set obs 200
    forval i=1/7{
        gen dummy0`i'= rnormal(0, `i')>0
        lab variable dummy0`i' "0`i'"
    }
    gen y= rnormal()
    gen x= rnormal()
    estimates clear
    forval i=1/7{
        eststo: regress y x dummy0`i'
    }
    set scheme s1mono
    coefplot est*, keep(dummy*) vert nokey msym(oh) mcolor(black) ciopts(lcolor(black))
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.5 KB
ID:	1631780

    Comment


    • #3
      Andrew Musau Thanks a lot! Any idea how to get horizontal tags at the upper and lower bounds of the CIs?

      Comment


      • #4
        Do you mean capped spikes?

        Code:
        coefplot est*, keep(dummy*) vert nokey msym(oh) mcolor(black) ciopts(lcolor(black) recast(rcap))

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.9 KB
ID:	1631880

        Comment

        Working...
        X