Announcement

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

  • Choosing omitted variable for use with coefplot

    I have a difference-in-difference model with two years in the pre-event period and two years in the post-event period and am running a regression like the following:
    1) reg yvar treat_post treat post
    Where treat_post is the interaction of the variables treat and post.

    My question is about using coefplot to plot regression coefficients for a model similar to the following:
    2) reg yvar treat_tminus2 treat_tminus1 treat_tzero treat_tplus1 treat post
    Where treat_tminus2 is the interaction of treat and a dummy variable that takes on the value of one in year t-2 (similarly for the other variables).

    The goal is to graph the coefficients on the time trend variables to illustrate the trend relative to a baseline year. I understand that the treat_* variables in equation 2) are co-linear with each other, but I've included them all by design so that I can use the omitted option with coefplot. Here's the coefplot post estimation command I'm using:
    3) coefplot, omitted drop(treat post _cons) vertical yline(0)
    This does exactly what I want by plotting all of the trend variable coefficients and none of the others, and with the omitted option STATA chooses a baseline year that appears on the graph equal to zero.

    The problem is that I run the same regression and graph for multiple dependent variables, but sometimes STATA chooses to omit treat_tminus2 as the baseline year and other times it chooses to omit treat_tplus1. Is there a way to select what variable STATA omits from the regression in 2) due to collinearity? I'd like to have a consistent baseline year (probably treat_tminus2) for all of my graphs.

    Thank you for the help.
    Last edited by Kristen Valentine; 02 Feb 2017, 10:07.

  • #2
    3) coefplot, omitted drop(treat post _cons) vertical yline(0)
    This does exactly what I want by plotting all of the trend variable coefficients and none of the others, and with the omitted option STATA chooses a baseline year that appears on the graph equal to zero.
    Another way to think of the baseline year in the graph is the one that is not present. Therefore, if you want treat_tminus1 to be the baseline, just exclude it from the regression. Without factor variables or -xi- (interaction expansion), I do not think there is a way to control what variable is omitted due to collinearity. However, if you want the baseline year to take the value 0 in the coefplot, there is a way to achieve this:


    Code:
    *GENERATE A VARIABLE THAT TAKES THE VALUE 0 FOR ALL OBSERVATIONS
    gen zero=0
    
    *ASSUMING YOU WANT treat_tminus2 TO BE THE BASELINE YEAR, EXCLUDE IT FROM THE REGRESSION BUT INCLUDE THE ZERO VAR
    
    reg yvar zero treat_tminus1 treat_tzero treat_tplus1 treat post
    
    *RUN -coefplot- and explicity specify the xlabels (treat_tminus2 label corresponding to the zero var)
    
     coefplot, omitted drop(treat post _cons) vertical yline(0) xlabel(1 "treat_tminus2" 2 "treat_tminus1" 3 "treat_tzero" 4 "treat_tplus1")
    This will give you the same graph "as if" treat_tminus2 was automatically omitted due to collinearity.

    Comment


    • #3
      Very clever. Thanks Andrew

      Comment

      Working...
      X