Announcement

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

  • Help with Time trends and collinearity in a panel data set

    Dear Statalister,

    I have a panel data set (xtset msa year) for 291 MSAs over eight years. I have run a regression with leads and lags of the treatment, MSA time trends, and two-way fixed effects. I have created leads and lags for six time periods in total. Primarily, I would like to know if I have used the right commands to create various dummies. I have a feeling it is not correct as I face the issue of collinearity among the time trend variables. The code follows for your reference.

    * code to create the leads and lags
    [gen treatf1 = f1.treat][/CODE]
    [replace treatf1 = treatf1[_n-1] if treatf1 == .][/CODE]

    [gen treatf2 = f2.treat][/CODE]
    [replace treatf2 = treatf2[_n-1] if treatf2 == .][/CODE]

    [gen treatf3 = f3.treat][/CODE]
    [replace treatf3 = treatf3[_n-1] if treatf3 == .] [/CODE]

    [gen treatl1 = l1.treat][/CODE]
    [replace treatl1 = treat[_n+1] if treatl1 == .][/CODE]

    [gen treatl2 = l2.treat][/CODE]
    [replace treatl2 = treatl2[_n+1] if treatl2 == .][/CODE]
    [replace treatl2 = treatl2[_n+1] if treatl2 == .][/CODE]

    [gen treatl3 = l3.treat][/CODE]
    [replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]
    [replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]
    [replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]

    * creating a time trend for each variable
    [bys msa: gen time = _n][/CODE]

    * Creating the interaction term between time and msa to generate msa time trends
    [xi i.msa i.year i.msa*time][/CODE]

    [xtreg `x' treatf2 treatf1 treat treatl1 treatl2 treatl3 prop_pop_age_20_60 pct_atleast_bach prop_labour_force prop_unemployed_pop prop_unemployed_women median_earnings i.year, fe vce(cl msa)][/CODE]

    I run the above regression in a loop as I have more than one dependent variable.

    This regression runs without any collinearity issue for all the dependent variables.

    I now add MSA time-trends to the above regression.

    [xtreg `x' _ImsaX* treatf2 treatf1 treat treatl1 treatl2 treatl3 prop_pop_age_20_60 pct_atleast_bach prop_labour_force prop_unemployed_pop prop_unemployed_women median_earnings i.year, fe vce(cl msa)][/CODE]

    Here I face the issue of collinearity for one of the dependent variables and not for the other. This is quite odd to me as I believe collinearity is independent of the dependent variable.

    From previous posts on this forum, I gather this could be an issue of too many variables with too little observations in comparison. OR. It could be that the time dummies are taking up all the variation across time, but I am referring to Autor(2003) who runs the same regression.

    However, I am not sure. I request your help for the same.

    Thank you!

  • #2
    Rohin:
    welcome to this forum.
    Some comments about your query:
    - it's better to use -fvvarlist- for creating categorical variables and interactions;
    - it's not clear whether you refer to more thatn one dependent variables (ys) or, more likely, independent variables(xs);
    - if there'collinearity between the fixed effect and one (I assume) of your predictors, there's nothing you can do but changing your model specification.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo:
      Thank you for your response.
      - I am referring to more than one dependent variable. What I mean is when I use say dependent variable "A" I don't face a collinearity issue. However, when I use the dependent variable "B", I encounter the issue of collinearity.
      - The collinearity here is between the msa time trend variables. There is no collinearity between fixed effects and any other independent variables.

      Comment


      • #4
        Rohin:
        thanks for clarifying.
        Perfect collinearity is simply a matter of fact; there's nothing you can do but changing your regression specification.
        Unfortunately I do not know and do not have access to the article you mention; hence, I cannot be more helpful.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you for your help, Carlo.

          Comment

          Working...
          X