Announcement

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

  • coefplot: Variable labels with time series operators and a macro

    Say I run a model with time series operators lagging each of two independent variables, listed in a macro, and store the estimates to generate a coefficient plot of just one of the varaibles:

    Code:
    clear all
    input float(year panelid yvar xvar1 xvar2)
    1999 1 3 2 3
    2000 1 5 2 7
    2001 1 6 3 9
    2002 1 5 3 1
    1999 2 4 8 2
    2000 2 8 8 4
    2001 2 9 8 8
    2002 2 9 8 9
    1999 3 2 9 1
    2000 3 1 9 3
    2001 3 3 7 4
    2002 3 4 6 5
    end
    lab var xvar1 "Ind. Var. 1"
    lab var xvar2 "Ind. Var. 2"
    local ivars xvar1 xvar2
    xtset panelid year
    qui eststo: xtreg yvar l.(`ivars')
    coefplot, keep(l.(`ivars'))
    coefplot, keep(l.xvar1)
    coefplot, keep(*`ivars')
    You should see that the first two coefplot commands cannot find any coefficients, while the final command only plots the first coefficient even though (I think) the syntax should produce plots for both (when the coefplot command includes a macro with multiple selected variables, it still plots only the first variable). Also, Stata includes "L." with the variable label.

    I have two questions:
    1. How should I keep selected variables in the coefplot command when I've used a combination of macros and time series operators?
    2. How should I remove "L." from the coefficient labels?
    As for question 2, for example, esttab includes a sub() option, where for regression output I use sub(L. ""), and that removes the "L." from all variable labels. Does coefplot have such an option?
Working...
X