Announcement

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

  • Panel Data DiD FE Regression Multicollinearity error

    Hi, I was wondering if someone could please help me with a problem I'm having in generating a Difference in Difference regression employing Fixed effects with panel data?
    When I include my Treatment group dummy variable and post treatment dummy variable both are omitted by the package due to multicollinearity and I'm not sure why.
    My code is below:

    ssc install asdoc
    ssc install outreg2
    cap ado uninstall ftools
    net install ftools, from("https://raw.githubusercontent.com/sergiocorreia/ftools/master/src/")
    cap ado uninstall reghdfe
    net install reghdfe, from("https://raw.githubusercontent.com/sergiocorreia/reghdfe/master/src/")

    // Generating Post Treatment Dummy
    gen Post=1
    replace Post = 0 if year >= 2010 & year <= 2014
    tab year Post

    // Identifying treatment group and control group
    tab val
    gen Treatment_Group=1
    gen contains_Kansas = strpos(location_name, "Kansas") > 0
    replace Treatment_Group = 0 if contains_Kansas == 1
    drop contains_Kansas
    tab location_name Treatment_Group

    // Generating Treatment Effect Coefficient [ ẟ ]

    gen Difference_Effect = Treatment_Group * Post
    encode location_name, gen(location_name1)

    // Graphing the Mortality Rate Trend

    bysort year: egen avg_val_NE = mean(val) if Treatment_Group == 1
    bysort year: egen avge_val_KS = mean(val) if Treatment_Group == 0
    twoway line avg_val_NE avge_val_KS year

    // Difference-in-Difference Regression
    xtset location_name1 year
    xtreg val Treatment_Group Post Difference_Effect, fe // (Here Treatment_Group is omitted but not Post)

    // I also tried this where both variables again get omitted

    asdoc reghdfe val Treatment_Group Post Difference_Effect, absorb(location_name year)

    My data consists of every county in two States in the US across a ten year period, in which the data is organised by county by year

    I would be hugely grateful for any help, Thank You!




  • #2
    There is neither any mystery about this, nor anything going wrong. Your Treatment_Group variable is a time-invariant attribute of any location: whether it is located in NE or KS. So it is colinear with the location fixed effect. The reason Post is not omitted is that your -xtreg- command does not include any time fixed effects. If it did, Post would disappear as well, as it would be a panel-invariant attribute of year. (If you want your -xtreg- to have year fixed effects, you have to add i.year to the list of variables in the model.)

    Comment


    • #3
      Thank you I appreciate the help

      Comment


      • #4
        I also had a quick follow up question, if I were to control for a time invariant variable such as gender/ethnicity would this collinearity then also occur? Would it be correct to use the model on that population rather than include it as an extra independent dummy variable ?

        Comment


        • #5
          ...if I were to control for a time invariant variable such as gender/ethnicity would this collinearity then also occur?
          Yes, it would.

          Would it be correct to use the model on that population rather than include it as an extra independent dummy variable ?
          I don't know what this means.

          Comment


          • #6
            Thank you for the clarification, "Would it be correct to use the model on that population rather than include it as an extra independent dummy variable ?" sorry for the wording on this I actually think you cleared it up in answering the first part of the question, thanks again for the help

            Comment

            Working...
            X