Announcement

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

  • Coefplot for coefficient of various estimates

    The following code is supposed to create a graph ( like the attached one here ) but unfortunately, I'm getting an error saying - invalid 'size'
    r(198);

    any help or guidance from anyone

    Code:
    *******COEFPLT Dr. DUBE 
    global SDUMMY     i.statefip i.year
    eststo clear
    reghdfe ln_weekearn  ///
    cdme ///
    hks sks /// 
    aj lks  /// 
    rising  $SDUMMY [aw=earnwt] , absorb(i.statefip) vce(cluster statefip) 
    eststo e1 
    
    coefplot (e1 , mcolor(red%50) msymbol(O) msize(large) ciopts(recast(rcap)) color(red%50)) keep(cdme)) ///
    (e1 , mcolor(green%50) msymbol(S) msize(large) keep(hks sks) ciopts(recast(rcap)) color(green%50)))  ///
    (e1 , mcolor(purple%50) msymbol(T) msize(large) keep(aj)  ciopts(recast(rcap)) color(purple%50))) ///
    (auto_dube , mcolor(blue%50) msymbol(D) msize(large) keep(rising)  ciopts(recast(rcap)) color(blue%50))) , ///
    scheme(plotplain) xtitle("COEFOLOT"), size(large) /// 
    xline(0, lcolor(gs7) lpat(solid) legend(off) grid(none)) ///
    yline(3 10 18, lcolor(gs7%40)) lapt(dot)) ///
    groups(cdme ="{bf:Local}") ///
    hks sks ="{bf:Spectrum}") ///
    aj lks  = "{bf:Industry}") /// 
    rising = "{bf:demand}") 
    gr export "coefplot.pdf", replace


    Code:
     * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(ln_weekearn cdme hks sks aj lks rising) double earnwt byte statefip int year
           . -.1 0 1 1 0 0          0 1 1996
           . -.2 0 1 1 0 0          0 1 1996
           . -.3 0 1 1 0 0          0 1 1996
    6.520998 -.3 0 1 1 0 0 11868.2414 8 2002
           . -.1 0 0 1 0 0          0 4 1998
           . -.2 0 0 1 0 0          0 4 1998
           . -.3 0 0 1 0 0          0 4 1998
     7.23574 -.3 0 0 1 0 0 10622.8448 8 2002
           . -.1 0 0 0 0 0          0 6 1999
           . -.2 0 0 0 0 0          0 6 1999
           . -.3 0 0 0 0 0          0 6 1999
           . -.3 0 0 0 0 0  9430.3123 6 2004
           . -.1 0 0 0 0 0          0 1 1996
           . -.2 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0 10478.1475 6 2004
           . -.2 0 0 1 0 0          0 6 1997
           . -.3 0 0 1 0 0          0 6 1997
           . -.3 0 0 1 0 0          0 6 1997
    5.990339 -.2 0 1 1 0 0 13736.5457 4 2008
           . -.2 0 0 1 0 0          0 1 1996
           . -.3 0 0 1 0 0          0 1 1996
           . -.3 0 0 1 0 0          0 1 1996
     6.19718 -.2 0 0 1 0 0  9774.6278 4 2008
           . -.2 0 0 0 0 0          0 8 1999
           . -.3 0 0 0 0 0          0 8 1999
           . -.3 0 0 0 0 0          0 8 1999
           . -.2 0 0 0 0 0  9183.4515 2 2010
           . -.2 0 0 1 0 0          0 1 1996
           . -.3 0 0 1 0 0          0 1 1996
           . -.3 0 0 1 0 0          0 1 1996
     6.19718 -.2 0 0 1 0 0 11644.6988 2 2010
           . -.3 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0          0 1 1996
    6.846935 -.2 0 0 0 0 0 11644.6988 4 2012
           . -.2 0 1 1 0 0          0 1 1996
           . -.3 0 1 1 0 0          0 1 1996
           . -.3 0 1 1 0 0          0 1 1996
    6.873564 -.2 0 1 1 0 0 11005.0987 4 2012
           . -.2 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0          0 1 1996
           . -.2 0 0 0 0 0   10399.04 1 1996
           . -.3 0 0 0 0 0          0 1 1996
           . -.3 0 0 0 0 0          0 1 1996
           . -.2 0 0 0 0 0          0 1 1996
           . -.2 0 0 0 0 0 11189.5283 1 1996
           . -.3 0 0 1 1 0          0 8 1996
           . -.3 0 0 0 0 0          0 8 1996
           . -.2 0 0 0 0 0          0 8 1996
           . -.2 0 1 1 0 0  14571.094 1 1996
           . -.3 0 0 1 1 0          0 1 1996
           . -.3 0 0 1 1 0          0 1 1996
           . -.2 0 0 1 1 0          0 1 1996
    5.943821 -.2 0 0 1 1 0 14568.3216 6 1998
           . -.3 0 0 1 0 0          0 1 1996
           . -.3 0 0 1 0 0          0 1 1996
           . -.2 0 0 1 0 0          0 1 1996
    5.999409 -.2 0 0 1 0 0 10463.1051 8 1999
    Attached Files

  • #2
    This is the picture of the original code ( which produced the neat-looking graph above ) I'm trying to replicate from Dr. Arindrajit Dube.
    Attached Files

    Comment


    • #3
      coefplot is from the Stata Journal/ SSC, as you are asked to explain (FAQ Advice #12).

      coefplot (e1 , mcolor(red%50) msymbol(O) msize(large) ciopts(recast(rcap)) color(red%50)) keep(cdme)) ///
      (e1 , mcolor(green%50) msymbol(S) msize(large) keep(hks sks) ciopts(recast(rcap)) color(green%50))) ///
      (e1 , mcolor(purple%50) msymbol(T) msize(large) keep(aj) ciopts(recast(rcap)) color(purple%50))) ///
      (auto_dube , mcolor(blue%50) msymbol(D) msize(large) keep(rising) ciopts(recast(rcap)) color(blue%50))) , ///
      scheme(plotplain) xtitle("COEFOLOT"), size(large) ///
      xline(0, lcolor(gs7) lpat(solid) legend(off) grid(none)) ///
      yline(3 10 18, lcolor(gs7%40)) lapt(dot)) ///
      groups(cdme ="{bf:Local}") ///
      hks sks ="{bf:Spectrum}") ///
      aj lks = "{bf:Industry}") ///
      rising = "{bf:demand}")
      gr export "coefplot.pdf", replace

      The highlighted may be the source of your error. You already are specifying options then you add a comma and another option. The fix may be as simple as removing the comma, but the general advice for debugging graph errors is to start small and then gradually build up.

      Comment


      • #4
        That was very helpful and insightful advice for a beginner coder like me. Actually, following your suggestion, I started from scratch by doing little by little, and eventually I came with a much better result than I got in the beginning. Yet to put the finishing touch but listening to you I'm certainly gonna reach there. Again appreciate your kind advice so so much!

        Comment


        • #5
          Originally posted by Tariq Abdullah View Post
          That was very helpful and insightful advice for a beginner coder like me. Actually, following your suggestion, I started from scratch by doing little by little, and eventually I came with a much better result than I got in the beginning. Yet to put the finishing touch but listening to you I'm certainly gonna reach there. Again appreciate your kind advice so so much!
          Hi Tariq,

          May I know where to get the replication package of Dr. Arindrajit Dube?

          Thank you.

          Comment


          • #6
            Hello Matthew,

            This is the coefplot package with the help of this trpe of graph can be produced. As Mr. Musau kindly suggested - it would be better if you can start from the scratch by taking little steps then that would be helpful to build up to the final stage. And, to. produce the exact graph if you follow the thread I attached the image of Dr. Arindrajit Dube's code too - though I haven't yet been able to replicate the exact command of Dr. dube, but I've been successful to repicate a portion of it. The coefplot was contributed to the economics community by Dr. Ben jann. Hope this helps and if you can replicate the code of Dr. dube kindly give me a knock ! would appreciate that .


            http://repec.sowi.unibe.ch/varia/Ode...dense-2018.pdf

            Comment


            • #7
              Originally posted by Tariq Abdullah View Post
              Hello Matthew,

              This is the coefplot package with the help of this trpe of graph can be produced. As Mr. Musau kindly suggested - it would be better if you can start from the scratch by taking little steps then that would be helpful to build up to the final stage. And, to. produce the exact graph if you follow the thread I attached the image of Dr. Arindrajit Dube's code too - though I haven't yet been able to replicate the exact command of Dr. dube, but I've been successful to repicate a portion of it. The coefplot was contributed to the economics community by Dr. Ben jann. Hope this helps and if you can replicate the code of Dr. dube kindly give me a knock ! would appreciate that .


              http://repec.sowi.unibe.ch/varia/Ode...dense-2018.pdf
              Hi Tariq,

              Thank you for your reply and helpful suggestions. I appreciate that.

              However, may I know where did you get the code of Dr. Arindrajit Dube? Or from which paper of him (you took a screenshot of his code, so I guess you may know the source)?

              Comment


              • #8
                Hi Matthew
                If you don't mind may I have your email id ? I'd prefer giving you the link over other platform if you don't mind.

                Comment


                • #9
                  Originally posted by Tariq Abdullah View Post
                  Hi Matthew
                  If you don't mind may I have your email id ? I'd prefer giving you the link over other platform if you don't mind.
                  Thank you for the kind support. I sent you a private message, so please check your inbox.

                  Comment

                  Working...
                  X