Announcement

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

  • multiple fixed effects using areg or reg

    Hi, new to stata!

    Struggling to figure out how to include fixed effects for industry country and time in my regression. I am trying to find out, after controlling for industry, country, and year, the effect that internet usage rates have had on exports, and I want to understand how this effect differs according to how technology-intensive the industry is.


    I have export data for every country, over 5 years broken down by industry (99 industries) - and for each industry I also have a corresponding industry R&D intensity variable (1-4). I also have data on %internet users by country for each year.

    sample: country_code 4:afghanistan. country_code 8:albania.
    year country_code industry_code intensity exports_usd internet_users
    1998 4 19 2 209823 .15
    1998 4 20 4 23423 .15
    1998 4 21 3 988474 .15
    1998 4 22 2 3344 .15
    1998 4 23 1 134523 .15
    1998 8 19 2 46578435 .22
    1998 8 20 4 555675 .22
    1998 8 21 3 3837 .22
    1998 8 22 2 863522 .22
    1998 8 23 1 43355 .22
    2002 4 19 2 435246 .18
    2002 4 20 4 445554 .18
    Again, trying to control for fixed country, time, and industry effects, and see w

    YTCI =alphaCT + betaIT + gammaCI + (Dintensity * deltausers_CT)

    where:

    alphaCT is the term for country year fixed effects, which I generated using egen c_y = group (country_code year), label
    betaIT is the term for industry year fixed effects, which I generated using egen i_y = group (industry_code year), label
    gammaCI is the term for country industry fixed effects, which I generated using egen c_i = group (country_code industry_code), label
    Dintensity is a dummy for industry intensity
    deltausers_CT is country time investment in IT


    I can't use fixed effects panel data form what i understand, because my variables for industry intensity are constant over time, so they get omitted. Even then, I have to first group (country_industry), and then set xtset country_industry year.


    I tried to run it as reg log_exports i_y c_i c_y internet_users i.intensity does this approach make sense to any others? I don't know if what I am doing here actually "controls" for industry-year, country-industry and country-year effects. I got the following results

    Click image for larger version

Name:	Screen Shot 2016-08-10 at 1.53.12 PM.png
Views:	1
Size:	59.5 KB
ID:	1352650


    a) is this even correct
    b) could I run it instead with areg? If so, how?

  • #2
    I think what you're looking for is

    Code:
    reg log_exports internet_users#intensity i.industry i.country i.year
    It's also possible to use reghdfe (ssc install reghdfe), which would allow you to state
    Code:
    reghdfe log_exports internet_users#intensity, absorb(industry country year)
    If my syntax knowledge isn't failing me that is

    Comment


    • #3
      That is along the lines of what I was thinking especially the reghdfe one, (just with a c.internet_users#intensity because its a continuous variable like .15%, 20.3%, etc). But what I am worried about is that I don't just want to control for just country fixed effects. I want to control for country-year, year-industry, and industry-country fixed effects - to say get rid of industry-based heterogeneity on a country level, or say country-specific time shocks. What do you think?

      Thanks again so much Jesse!

      Comment


      • #4
        whoops Jesse Wursten meant to say don't need to control for country-time I think, because otherwise I run intro trouble with co-linearity of the internet users, which as you can see are set for a given year and country. (if that makes sense...)

        Comment


        • #5
          Code:
          reg log_exports internet_users#intensity i.industry i.country i.year i.year#i.country i.year#i.industry i.industry#i.country
          Does that work? At this point you might run into a degrees of freedom problem though... (too many variables for the number of observations)

          Comment


          • #6
            Sometimes, it is possible to calculate values of the dv by the factors (e.g., average exports for each country, year, industry combination omitting the firm of interest) and use that as the control. After all, this is pretty much the combination of the dummies and interactions of dummies should be doing. This saves you from piles of dummies/fixed effects.

            Comment

            Working...
            X