Announcement

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

  • multiple fixed effect wiith areg

    hi.
    i run this code, but i faced with an error.
    please help me.
    xi: areg inv RE_value index_state yr*, a(gvkey) cl(id)
    error: variable yr* not found
    although i run it yesterday, now error is created.
    note: regression must include firm fixed effect and year fixed effect .
    note2: areg must be used.
    note: this regression like above with industry and state fixed effect is run without error.
    xi: areg REAL_ESTATE0 qsset2-qsset5 qqroa2-qqroa5 qqage1 st1* st2* st3* st4* st5* st6* st7* st8* st9* if year==1993, a(sic2)
    Last edited by sahar shabani; 26 Feb 2019, 12:17.

  • #2
    Hi Sahar.
    one question: Why areg MUST be used.
    One answer. if you want to keep the code as it is, you need to create the year dummies, or include year with factor notation:
    Code:
    * Option 1.
    tab year, gen(yr_)
    drop yr_1 
     areg inv RE_value index_state yr_*, a(gvkey) cl(id)
    * Option 2
     areg inv RE_value index_state i.year, a(gvkey) cl(id)
    Option 2 assumes that you have a version of Stata that handles factor notation. You can always add the xi: prefix if you have a problem.
    HTH

    Comment


    • #3
      thank you Fernando. it is ok.
      because i am replicating a paper, i use the same code used in the paper.
      i want to understand why that code is not run? i am confused.
      paper link:
      https://www.aeaweb.org/articles?id=1...aer.102.6.2381
      if you have time, please check reg.do.
      best regards.

      Comment


      • #4
        You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. If you want us to help you, you need to tell use exactly what you're trying to replicate - just citing a paper is not good enough.

        The obvious reason yr* is not found is that you don't have a variable starting with yr. Look at the variables in your dataset right before the areg - you can do this with su y* or ds y* or just by looking at the variable window.

        Comment

        Working...
        X