Announcement

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

  • Industry level panel regressions

    Hello,

    I am working with firm panel data and I need to estimate the following regression at SIC-2-digit industry level:

    return_i,t = alpha_j + beta_j*OilPriceGr_t + e_i,t

    where index i denots firm and j stands for industry. I want to estimate the sensitivity of firm i return to oil price at the industry level using returns of fi…rms that share the same 2-digit Standard Industrial Classi…cation (SIC) code. Can this be done using rangestat, something like the following:
    Code:
    rangestat (reg) return OilPriceGr, by(sic_2_digit) interval(OilPriceGr . .)
    Thank you.

  • #2
    Yes, that code will separately estimate the regression model in your post for each 2-digit SIC code. The coefficients, standard errors, N, and R2 will be stored as new variables in the data set. This, of course, assumes that your variables are stored as numeric and the patterns of missing values do not lead to exclusion of some industry groups due to insufficient data.

    There is one consideration, however, that may be important and is not dealt with. If you have multiple firms within industry and a single observation per form, there is no problem. But if each firm has multiple observations (in different time periods) then the ordinary regression performed by the -rangestat- command will not reflect the panel structure of the data--it will give you a pooled regression that does not account for the dependence of within-same-firm observations. So you may want to do something more like this:

    Code:
    capture program drop one_industry
    program define one_industry
        xtset firm_id
        xtreg return OilPriceGr, fe
        gen b_cons = _b[_cons]
        gen se_cons = _se[_cons]
        gen b_OilPriceGr = _b[OilPriceGr]
        gen se_OilPriceGr = _se[OilPriceGr]
        gen n_obs = e(N)
        gen n_firms = e(N_g)
        exit
    end
    
    runby one_industry, by(sic_2_digit) status
    Notes:
    1. Not tested because no example data was provided. Be ware of typos or other errors.
    2. Consider refining the -xtreg- command to include year indicators or clustered standard errors, if appropriate to your situation.
    3. -runby- is written by Robert Picard and me, and is available from SSC.
    4. If there are any SIC codes where the number of observations or outcome variance is insufficient to support estimation, or if some other problem prevents successful completion of program one_industry, this will be reported in the "Groups with errors" output from -runby-. Those errors do not terminate -runby- and it continues to do the regressions in the other industries.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Yes, that code will separately estimate the regression model in your post for each 2-digit SIC code. The coefficients, standard errors, N, and R2 will be stored as new variables in the data set. This, of course, assumes that your variables are stored as numeric and the patterns of missing values do not lead to exclusion of some industry groups due to insufficient data.

      There is one consideration, however, that may be important and is not dealt with. If you have multiple firms within industry and a single observation per form, there is no problem. But if each firm has multiple observations (in different time periods) then the ordinary regression performed by the -rangestat- command will not reflect the panel structure of the data--it will give you a pooled regression that does not account for the dependence of within-same-firm observations. So you may want to do something more like this:

      Code:
      capture program drop one_industry
      program define one_industry
      xtset firm_id
      xtreg return OilPriceGr, fe
      gen b_cons = _b[_cons]
      gen se_cons = _se[_cons]
      gen b_OilPriceGr = _b[OilPriceGr]
      gen se_OilPriceGr = _se[OilPriceGr]
      gen n_obs = e(N)
      gen n_firms = e(N_g)
      exit
      end
      
      runby one_industry, by(sic_2_digit) status
      Notes:
      1. Not tested because no example data was provided. Be ware of typos or other errors.
      2. Consider refining the -xtreg- command to include year indicators or clustered standard errors, if appropriate to your situation.
      3. -runby- is written by Robert Picard and me, and is available from SSC.
      4. If there are any SIC codes where the number of observations or outcome variance is insufficient to support estimation, or if some other problem prevents successful completion of program one_industry, this will be reported in the "Groups with errors" output from -runby-. Those errors do not terminate -runby- and it continues to do the regressions in the other industries.
      Thank you very much! Yes, my data include multiple observations per firm so then runby is more suitable. The code works well. Sorry if I am asking a stupid question - but if I were to estimate the same regression at firm level to get the estimated sensitivity for each firm, given the panel structure of the data, should I also use runby ? Thanks again for a very detailed explanation!

      Comment


      • #4
        Yes, I would still do it using -runby- with -by(firm-id)- instead of -by(sic_2_digit)-. Also, since you would then be doing the regression within firm, and, I presume, there is no nesting structure within firms other than repeated observations, I would change the program by eliminating the -xtset- command and replacing -xtreg- with simple -regress-., and eliminating the -gen n_firms...- command.

        Comment


        • #5
          Originally posted by Clyde Schechter View Post
          Yes, I would still do it using -runby- with -by(firm-id)- instead of -by(sic_2_digit)-. Also, since you would then be doing the regression within firm, and, I presume, there is no nesting structure within firms other than repeated observations, I would change the program by eliminating the -xtset- command and replacing -xtreg- with simple -regress-., and eliminating the -gen n_firms...- command.
          Ok, great. Thank you once again for your help!

          Comment

          Working...
          X