Announcement

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

  • OLS regresion at individual and group level. Collapse?

    Good morning one and all.

    I have a database with information for 40 urban regions. Within each region, there are a different number of cities. I want to do an OLS regression at the scale of urban regions (not cities), so I have to "collapse" (I don't know if that's the correct term) the data from the database because each row in the database (each city ) repeats the data from the urban region.

    What I have done is use:
    collapse (mena) var_list , by (id_urbanregion)

    And then run the regression with OLS:
    reg var1_region var2_region region_var3 region_var4 region_var5 , r

    Is it correct, or is there another way to do it? Clearly, results between individuals (cities) and groups (urban regions) are completely different, so I am unsure if my procedure is OK using STATA commands.

    Could you give me some advice? I really appreciate it!

    Best,
    Diego

  • #2
    Diego:
    your code (-mena- reads -mean-) is correct.
    Obviously the two regressions give back different results, as the latter investigates data aggregated at regional level.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo, thanks for your kind answer.
      Considering that each urban region has a different number of cities, do I need to wight somehow when I collapse my data? Sorry for bothering you with these basic questions, but I did not find a clear answer in the books.
      Thanks,
      Diego

      Comment


      • #4
        Diego:
        yes,
        See -[fw=number]- examples available from -collapse- helpfile.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X