Announcement

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

  • Industry and Country effect cross sectional regression

    Hello Statalist Forum,

    I am looking at the industry and country effect in 16 countries and 10 industries and how these effects emerge over time. My dataset consists of daily rate of returns (RoR) from 1975 to 2018. To get the country and industry effect I created dummy variables for each country and each industry. I want to run a weekly/yearly cross sectional regression with the dependent variable being the rate of return and the independent variables are the dummy variables created. This is done for each country and each industry so that I would like to do

    1.
    Code:
    regress RoR MatsD GdsD SvsD FinD HealthD IndD OilD TechD TeleD UtilsD AustriaD BelgiumD DenmarkD FinlandD FranceD GermanyD GreeceD IrelandD ItalyD NetherlandsD NorwayD PortugalD SpainD SwedenD SwitzerlandD UnitedKingdomD 
    but by year and Country/Industry. This should result in a time series of the coefficients produced by the cross sectional regression.

    To do this I used the following code:

    2.
    Code:
    bys year Country: asreg RoR MatsD GdsD SvsD FinD HealthD IndD OilD TechD TeleD UtilsD AustriaD BelgiumD DenmarkD FinlandD FranceD GermanyD GreeceD IrelandD ItalyD NetherlandsD NorwayD PortugalD SpainD SwedenD SwitzerlandD UnitedKingdomD 
    Where all variables ending with a D are dummy variables for the country or industry. Because I never worked with this command before I am not sure if it is the proper way to do the cross sectional analysis or if it even yields the right coefficients.

    Furthermore, this yield equally weighted estimates. Is there a way to include value weighted estimates? Is there a way to include
    Code:
    [aweight=weight]
    in the second regression?

  • #2
    Kim:
    welcome to this forum.
    Some comments about your query:
    1) if, as it seems, you have a T>N panel dataset, you may want to take a look at -xtgls- and -xtregar- commands.
    2) if you didn't do it already, -reshape- your data in -long- format, which is the best to deal with most of the statistical analyses;
    3) you can avoid creating tons of dummies yourself; just rely on the wonderful capabilities of -fvvarlist-, instead.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Thank you Carlo!

      input int Date str14 Country str12 Industry double RoR
      5479 "Austria" "Basic Mats" .
      5479 "Austria" "Telecom" .
      5479 "Austria" "Oil Gas" .
      5479 "Austria" "Utilities" .
      5479 "Austria" "Health Care" .
      5479 "Austria" "Industrials" .
      5479 "Austria" "Financials" .
      5479 "Austria" "Market" .
      5479 "Austria" "Consumer Svs" .
      5479 "Austria" "Consumer Gds" .
      5480 "Austria" "Basic Mats" 0
      5480 "Austria" "Utilities" .
      5480 "Austria" "Health Care" .
      5480 "Austria" "Consumer Svs" .
      5480 "Austria" "Consumer Gds" .
      5480 "Austria" "Market" 0
      5480 "Austria" "Telecom" .
      5480 "Austria" "Oil Gas" .
      5480 "Austria" "Financials" 0
      5480 "Austria" "Industrials" 0
      5481 "Austria" "Consumer Svs" .
      5481 "Austria" "Telecom" .
      5481 "Austria" "Market" 0
      5481 "Austria" "Health Care" .
      5481 "Austria" "Basic Mats" 0
      5481 "Austria" "Oil Gas" .
      5481 "Austria" "Industrials" 0
      5481 "Austria" "Consumer Gds" .
      5481 "Austria" "Utilities" .
      5481 "Austria" "Financials" 0
      5484 "Austria" "Consumer Svs" .
      5484 "Austria" "Health Care" .
      5484 "Austria" "Oil Gas" .
      5484 "Austria" "Industrials" 0
      5484 "Austria" "Financials" 0
      5484 "Austria" "Market" 0
      5484 "Austria" "Consumer Gds" .
      5484 "Austria" "Basic Mats" 0
      5484 "Austria" "Telecom" .
      5484 "Austria" "Utilities" .
      5485 "Austria" "Industrials" 0
      5485 "Austria" "Health Care" .
      5485 "Austria" "Financials" 0
      5485 "Austria" "Oil Gas" .
      5485 "Austria" "Market" 0
      5485 "Austria" "Utilities" .
      5485 "Austria" "Basic Mats" 0
      5485 "Austria" "Consumer Gds" .
      5485 "Austria" "Telecom" .
      5485 "Austria" "Consumer Svs" .
      5486 "Austria" "Utilities" .
      5486 "Austria" "Basic Mats" 0
      5486 "Austria" "Financials" 0
      5486 "Austria" "Consumer Gds" .
      5486 "Austria" "Industrials" 0
      5486 "Austria" "Market" 0
      5486 "Austria" "Health Care" .
      5486 "Austria" "Oil Gas" .
      5486 "Austria" "Telecom" .
      5486 "Austria" "Consumer Svs" .
      5487 "Austria" "Health Care" .
      5487 "Austria" "Market" 0
      5487 "Austria" "Consumer Gds" .
      5487 "Austria" "Financials" 0
      5487 "Austria" "Basic Mats" 0
      5487 "Austria" "Telecom" .
      5487 "Austria" "Oil Gas" .
      5487 "Austria" "Consumer Svs" .
      5487 "Austria" "Utilities" .
      5487 "Austria" "Industrials" 0
      5488 "Austria" "Consumer Gds" .
      5488 "Austria" "Industrials" 0
      5488 "Austria" "Financials" 0
      5488 "Austria" "Utilities" .
      5488 "Austria" "Health Care" .
      5488 "Austria" "Oil Gas" .
      5488 "Austria" "Telecom" .
      5488 "Austria" "Consumer Svs" .
      5488 "Austria" "Market" 0
      5488 "Austria" "Basic Mats" 0
      5491 "Austria" "Oil Gas" .
      5491 "Austria" "Health Care" .
      5491 "Austria" "Utilities" .
      5491 "Austria" "Consumer Gds" .
      5491 "Austria" "Telecom" .
      5491 "Austria" "Consumer Svs" .
      5491 "Austria" "Basic Mats" 0
      5491 "Austria" "Industrials" .7812500000000031
      5491 "Austria" "Financials" 0
      5491 "Austria" "Market" .1737317581653827
      5492 "Austria" "Oil Gas" .
      5492 "Austria" "Health Care" .
      5492 "Austria" "Utilities" .
      5492 "Austria" "Consumer Svs" .
      5492 "Austria" "Consumer Gds" .
      5492 "Austria" "Financials" 0
      5492 "Austria" "Industrials" -1.162790697674423
      5492 "Austria" "Telecom" .
      5492 "Austria" "Basic Mats" 0
      5492 "Austria" "Market" -.2659266967279336
      end
      format %tdnn/dd/CCYY Date
      [/CODE]

      This is an example of my data without the dummy variables showing 100 out of more than 3.5 million observations.

      1. I can only use these commands if I am able to use xtset. But this is not possible because I have Country and Industry as variables so I get this error message: "repeated time values within panel" when I try to do
      Code:
      xtset Country Data
      and "too many variables specified" if I try
      Code:
      xtset Country Industry Date
      2. I think the data is already reshaped into long
      3. This is also only possible if I manage to get xtset right?

      Comment


      • #4
        I managed to declare the dataset by using
        Code:
        egen id=group(CountryCode IndustryCode)
        xtset id Date
        and now I would like to run this regression
        Code:
        bys s2 Country: xtreg RoR i.CountryCode i.IndustryCode, fe
        but I have a multicollinearity problem. Is it possible to take the value-weighted and equally-weighted market portfolio as a benchmark?

        Comment


        • #5
          Kim:
          I would say that multicollinearity is the rule with -fe- specification. If you want to stick with -fe-, I think you should live with it (or choose a different specification).
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            I don't think it makes sense to set the panel as country/industry and then include dummies for country and industry in xtreg. No wonder it is colinear - you're including country/industry twice. As Carlo's suggests, there is a problem with your specification. Actually, I suspect the egen is creating a separate panel id for each country-industry pairing but this will encompass your i.country i.industry.

            Comment

            Working...
            X