Announcement

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

  • How to add county fixed effect on a pooled cross-sectional data?

    Hello Statalists,

    I have a pooled cross-sectional data at individual house level i for the whole state of California. I want to add the county fixed effect for each county j to capture some county specifics. How do I do this?

    I tried to add
    Code:
     i.counties
    to the regression but it says "actor variables may not contain noninteger values". Any clues? Thanks


    Alex

  • #2
    It seems the "counties" variable is not a categorical one. You may check this out by typing descriptive commands, before fixing it.
    Best regards,

    Marcos

    Comment


    • #3
      Originally posted by Marcos Almeida View Post
      It seems the "counties" variable is not a categorical one. You may check this out by typing descriptive commands, before fixing it.
      Hi, i did this by typing
      tabulate county, gen dcounty
      and it generated about 800 dummies (dcounty1, dcounty2...dcounty 800) but when I tried to add
      i.dcounty
      to my regression it says dcounty ambiguous abbreviation. any clues?

      Comment


      • #4
        Hi,
        I don't think you need to create those dummies before hand.
        If county is a categorical variable, I believe you should be able to use i.county directly, and the reg command generates the dummies for you.

        Comment


        • #5
          Rocio is correct. Your regression statement should include i.county, not i.dcounty.
          Stata/MP 14.1 (64-bit x86-64)
          Revision 19 May 2016
          Win 8.1

          Comment


          • #6
            Originally posted by Rocio Fernandez Mendez View Post
            Hi,
            I don't think you need to create those dummies before hand.
            If county is a categorical variable, I believe you should be able to use i.county directly, and the reg command generates the dummies for you.
            what do you mean by categorical variable. I have like 800 different counties. does that mean i should have 800 indicators?

            Comment


            • #7
              Using the following will produce a regression with coefficients for each county (minus one used as the base category) plus your other independent variables—so 799 county coefficients:
              Code:
              reg yvar x1 x2 x3 i.county
              Stata/MP 14.1 (64-bit x86-64)
              Revision 19 May 2016
              Win 8.1

              Comment

              Working...
              X