Announcement

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

  • Inlcude industry- and year-fixed effects in regression

    Hello,

    I want to do a regression with one dependent variable and an independent variable and a few other variables to control for. In addition I want to control for industry- and year-fixed effects. I have a sample consisting of loan pricing data including the borrower company, the lender, the industry in which the firm operates, the year the loan was taken etc. and I want to show which loan characteristics influence the loan spread using an OLS regression. I have multiple firms operating in the same industry. I already grouped the industry by looking at the 2-digit SIC code leaving me with 10 industry dummies. Now I am not sure how to do a regression and controll for industry- and year-fixed effects.
    The command -xtset sic_group year- does not work it returns the error "repeated time values within panel", therefore I cannot continue using the command -xtreg, fe-


    Thanks!

  • #2
    Something like

    Code:
    reg loan_price X i.year i.sic_group
    would do the trick, whrere X are the covariates you are interested in. You could adjust the standard errors for clustering using the vce option like this

    Code:
    reg loan_price X i.year i.sic_group, vce(cluster sic_group)
    If you want to adjust standard errors for multiple clusters at the same time there are user-written commands like REGHDFE. Note that the above works because FE models are equivalent to models with dummies specified for each of the groups you want a within transformation for.

    Comment


    • #3
      Maybe this is also interesting for you: https://www.stata.com/meeting/chicag...16_correia.pdf
      Best wishes

      (Stata 16.1 MP)

      Comment


      • #4
        Jana:
        as an aside to previous helpful advice, you can work arounf "repeated time values within panel" just -xtset-ting your data with -panelid- only.
        Unfortunately, this fix comes at the cost of making time-series related commands, such as lags and leads, unfeasible.
        That said, it really weird that you have one predictor only in the right-hand side of your panel data regression equation (set aside controls). I would double-check whether your code gives a fair and true view of the data generating process you're studying.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X