Announcement

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

  • Coefplot- Different outcomes, one independent variable over time

    Hi,

    I have the following regressions:

    Code:
      
     eststo clear
        
    
    eststo sem1g: ivregress 2sls grade (housing=instrument) if semester==1, vce(r) //IV
    eststo sem1t5: ivregress 2sls top5 (housing=instrument) if semester==1 , vce(r) //IV
    eststo sem1t10: ivregress 2sls top10 (housing=instrument) if semester==1 , vce(r) //IV
    
    eststo sem2g: ivregress 2sls grade(housing=instrument) if semester==2, vce(r) //IV
    eststo sem2t5: ivregress 2sls top5 (housing=instrument) if semester==2 , vce(r) //IV
    eststo sem2t10: ivregress 2sls top10 (housing=instrument) if semester==2 , vce(r) //IV
    How can I plot the coefplot for the variable "housing" for all of the outcomes(grade, top5, top10) , separated by the semester? I have looked through the forum but I have not found anything that can help with what I exactly want.
    To be exact, I want it to look like the following plot:

    Click image for larger version

Name:	Your paragraph text.png
Views:	1
Size:	55.9 KB
ID:	1757037

  • #2
    Anyone who can help?

    Comment


    • #3
      Too bad that you don't provide an example to replicate, but if you can't get -coefplot- to do this for you, I would use -help postfile- to save the coefficients you are interested in into a new file, and then just plot the contents of that file with a regular -help twoway_dot- graph.

      Comment


      • #4
        Originally posted by Gobinda Natak View Post
        Too bad that you don't provide an example to replicate, but if you can't get -coefplot- to do this for you, I would use -help postfile- to save the coefficients you are interested in into a new file, and then just plot the contents of that file with a regular -help twoway_dot- graph.
        Thanks, here is an example of the data to replicate:

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input float(id grade top5 top10 semester housing instrument)
         1   .4430962       .25       .25 1 0 0
         1 -.13358703         0         0 2 0 0
         2  .03894464         0         0 1 1 1
         2 -1.2169484         0         0 2 1 1
         3  -.5927218         0         0 1 1 1
         3 -.14161418       .28       .28 2 1 1
         4   .2938398       .25       .25 1 0 0
         4  1.3441702         1         1 2 0 0
         5    -.42742       .25       .25 1 1 1
         5  -.6184571  .3333333  .3333333 2 1 1
         6  1.2497058         1         1 1 1 1
         6   .7064008        .4        .6 2 1 1
         7 -.29753825       .25       .25 1 1 1
         7  -.4294281         0         0 2 1 1
         8  -.5626787         0         0 1 1 1
         8  -.5956856         0         0 2 1 1
         9   .4098808         0        .5 1 1 1
         9  -.1975955 .14705883 .14705883 2 1 1
        10   1.196604        .6        .8 1 1 1
        10  .25098285       .25       .25 2 1 1
        11   .8947548        .5        .5 1 1 1
        11  -.5858306       .25       .25 2 1 1
        12   1.406335         1         1 1 1 0
        12  .27450433        .4        .4 2 1 0
        13  -.5134795         0         0 1 0 0
        13  .11924653  .3333333  .3333333 2 0 0
        14  1.1021477         0         1 1 1 1
        14 -.12462802  .3793103  .3793103 2 1 1
        15  -.8376226         0         0 1 1 1
        15  .14714698  .3421053  .4473684 2 1 1
        16   .8084729  .3333333  .6666667 1 1 1
        16  .54073656  .3333333  .3333333 2 1 1
        17   -1.47094         0         0 1 1 1
        17  -.4551369 .16666667 .16666667 2 1 1
        18   .9733542        .5        .5 1 1 1
        18   .3769173         0        .4 2 1 1
        19   .7044744         1         1 1 0 1
        19  -.5995409         0         0 2 0 1
        20  1.5721848         1         1 1 1 1
        20   .9947854  .8333333         1 2 1 1
        end

        Comment


        • #5
          Thanks, if you do

          Code:
          coefplot sem*, keep(housing)
          you'll need to label the y-axis somehow by hand, which isn't ideal, I guess, but as I said above, postfile and twoway dot should be able to do the trick

          Comment

          Working...
          X