Announcement

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

  • Coefplot: keep / drop coefficients from one model, not the whole plot

    Dear Statalist,

    I've recently started using coefplot command and like it's versatility, but I cannot work out how to use the keep command as a model option rather than a global option (as it seems you can from the help file (http://repec.sowi.unibe.ch/stata/coe...help-file.html).

    Specifically I would like to create a graph with 5 different models: each contains an identical list of individual level variables (model 1), and model 2-5 adds one country level variable each. If I show all of the models at once the individual level coefficients (which are pretty much the same - i.e. adds very little info) fall on top of each other and it looks cluttered. Instead I would like to include them in model 1 and exclude them from model 2-5, where I would like to only show the country level coefficients. I have tried the following command:

    coefplot (M1, label(Model 1)) (M2, label(Model 2), keep(zGini)) (M3, label (Model 3), keep (zGDPrev)) (M4, label (Model 4), keep (zWGIrev)) (M5, label (Model 5), keep (zMIPEXrev)) ///
    drop(_cons) xline(0)


    However, this does not work, and I get the error message

    invalid 'keep'
    r(198);


    What am I doing wrong, and does anyone know a way to do this? Hope you can help,
    Ingrid

  • #2
    Thanks to a little help from a friend, I figured out how to do this, and thought I'd post the syntax here in case anyone else had the same problem:

    coefplot (M1, label (Model 1), keep (* (M2, label (Model 2), keep(zGini)) (M3, label (Model 3), keep (zGDPrev)) (M4, label (Model 4), keep (zWGIrev)) (M5, label (Model 5), keep (zMIPEXrev)) ///
    drop(_cons) xline(0)

    Comment


    • #3
      Apologies for the accidental . The above syntax was supposed to be:

      coefplot (M1, label (Model 1), keep (*: ) (M2, label (Model 2), keep(zGini)) (M3, label (Model 3), keep (zGDPrev)) (M4, label (Model 4), keep (zWGIrev)) (M5, label (Model 5), keep (zMIPEXrev)) ///
      drop(_cons) xline(0)

      Comment

      Working...
      X