Announcement

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

  • Panel Data

    I am currently working on a project that examines how foreign aid affects Sub-Saharan Africa's economic growth. My data spans from 1980 to 2019, but in order to examine the impact of foreign aid over various time periods, I would like to break these years down into smaller time periods i.e 1980–1986, 1987–1993, 1994-2000, 2001-2007, 2008-2014 and 2015-2019. How do I do this in Stata and how do I carry out regressions over these sub periods.

    I also want to create a box and whiskers plot which shows the change in aid over these sub periods but I was wondering how to do this on Stata? I also wanted to do the same for the change in growth over these time periods.

    I look forward to hearing back from you.



  • #2
    Code:
    gen byte era = floor((year-1980)/7)
    will create a new variable era which demarcates each of these u-year eras into which you wish to divide the data. That variable, era, can then be used just like any other discrete variable in Stata. If you want to use it as a regressor, you just do -regression_command ... i.era...- (If you are not familiar with Stata's factor-variable notation, read -help fvvarlist- to learn about it before proceeding.) To create box plots, with a separate box for each of these eras, just put -era- in the -over()- option of your -graph box- command.

    Comment


    • #3
      Thank you for this! It was. really helpful. I had another question, how do I average the growth values during these sub periods using Stata? For example, averaging growth values from 1980-1986?

      Comment


      • #4
        Daniel:
        you may be interested in something along the following lines:
        Code:
        use "https://www.stata-press.com/data/r17/nlswork.dta"
        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
        
        . egen wanted=mean(ln_wage) if year<=80
        
        . list year wanted if idcode==1
        
               +-----------------+
               | year     wanted |
               |-----------------|
            1. |   70   1.594225 |
            2. |   71   1.594225 |
            3. |   72   1.594225 |
            4. |   73   1.594225 |
            5. |   75   1.594225 |
               |-----------------|
            6. |   77   1.594225 |
            7. |   78   1.594225 |
            8. |   80   1.594225 |
            9. |   83          . |
           10. |   85          . |
               |-----------------|
           11. |   87          . |
           12. |   88          . |
               +-----------------+
        
        .
        What above works if you're interested in the crude mean of -growth-, that differs from Compound annual growth rate - Wikipedia.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X