Announcement

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

  • Many regressions by country ID

    I have a panel of countries in long form for which I want to run regression by the country ID so I get coefficient specific to a country. so I have;

    HTML Code:
    local predictor year
    
    foreach p of local predictor {
        qui bysort id: regress lnpr `p'
        *outreg2 using regressions, excel 
    }
    But I want now to take the coefficients and paste them back along their corresponding countries in a new variable so that I can then find which country has the highest beta.

    say data looks like
    HTML Code:
    			id    year    country    lnpr
    			81    2000    Guinea    3.269569
    			81    2004    Guinea    3.113515
    			82    2000    congo   2.85647
    			82    2004    congo    3.238678
    			83    2000    mali    2.839078
    			83    2004    mali    3.206803
    How do I retrieve the betas in a new variable along the corresponding countries?

  • #2
    Use rangestat, with some examples given in this post: https://www.statalist.org/forums/for...edicted-values

    Comment


    • #3
      Jorrit Gosens Thanks a lot for the pointer and also regards to for the great suggestion. Worked like a charm!

      Comment

      Working...
      X