Announcement

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

  • Am I using the correct code for running the models separately for each industry?

    Hi all,

    I have an unbalanced panel data, 11 industries and 21 years.

    After doing the main regression test, I want to run the models separately for each industry for 21 years.

    Here is my code:
    - tab industry, gen (I) -
    > then I get 11 industries from I(1) to I(11)
    - bys I1: xtreg Y A B C D E -

    1Q. Is this the correct coding that can give me the regression result for industry(1) only? (in return, Stata gives me the results of -> I(1) = 0, or -> I(1) =1).

    code:

    - bys I1: xtreg Y A B C D E i.Time, fe -
    - est store fe -

    - bys I1: xtreg Y A B C D E i.Time, re -
    -est store re-

    -hausman fe re-


    2Q. is this the correct code for checking fixed effect or random effect for industry(1) and controlling for the Time effect?


    3Q. the results give me the similar correlation (between my dep var and indep var) with my main regression ( - xtreg Y A B C D E i.Time i. Industry, re, or xtreg Y A B C D E i.Time, fe).
    however, most of them become not significant and the R-square drop dramatically.

    Is that because of the small sample size? ( in total, I roughy have 30,000 firm-year observations, while industry(1) only have around 1500 firm-year observations.


    if so, can I have some suggestion for doing that please?

    Thanks in advance

    Neng

  • #2
    You didn't get a quick answer. You will increase your chances of useful answer by following the FAQ on asking questions-provide Stata code in code delimiters readable Stata output, and sample data using dataex. This will make it easier for us to help you.

    I have never seen by sort used with xtreg. I suspect what you really want is statsby.

    If you want to run it for one industry, use an if statement before the comma rather than trying to do it with bysort.

    A small sample, and 1500 observations is not that small, should not change your R squared until you get really really small. And then, it should increase the apparent R squared. It's not clear what the fixed effects or panel setting is for your data. If it is firm, and you have roughly 20 years of observations for each firm, then estimating this model with 1500 observation should be fine. It may be that legitimately this model does not fit in some industries while it fits in others.

    Comment


    • #3
      Thanks so much, Phil

      Apologies for my previous output.
      I found that they both give me the same results but the "if command" is much easier.

      Code:
      bys I1: xtreg Y A B C D E
      Code:
      xtreg Y A B C D E if I1
      Much appreciate

      Neng

      Comment

      Working...
      X