Announcement

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

  • How do I create a variable storing the average change in population growth per country across a 10 year period?

    As the title suggests, I'm working with census data. I'd like to generate a variable that stores the average annual rate of change in population growth across a 10 year period.
    My variables are as follows: 'YEAR' = 2005-2015; 'country' = 87 countries of interest; 'TOTPP' = estimate of total population. Can anyone help me out with the command for this? Thanks in advance!

  • #2
    Nobody? : (

    Comment


    • #3
      The most common reason questions go unanswered is that the question is unclear. That, for me, is certainly the case with your question.

      Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post, looking especially at sections 9-12 on how to best pose your question. It would be particularly helpful to post a small hand-made example, with your 11 years of data for just two or three countries, showing the data and the results you expect to calculate from that data. In particular, please read FAQ #12 and use dataex to post your sample data to Statalist.

      With sample data to play with and a clear explanation of what the expected result is, perhaps someone can help. How do you define "population growth" from population? How to do you define the "rate of change in population growth"? How do you average this - across the 11 years separately for each country, or across all countries separately for each year, or across all countries and all years?

      The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

      Comment


      • #4
        Hey William,

        Thanks for clearing that up for me. To begin anew, these are the variables I'm working with:
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input long country double(YEAR TOTPP)
        269 2005 296139635
        269 2006 298860519
        269 2007 301655953
        269 2008 304473143
        269 2009 307231961
        269 2010 309876170
        269 2011 312390368
        269 2012 314799465
        269 2013 317135919
        269 2014 319448634
        269 2015 321773631
        270 2005    107768
        270 2006    107477
        270 2007    107166
        270 2008    106859
        270 2009    106590
        270 2010    106382
        270 2011    106244
        270 2012    106174
        270 2013    106166
        270 2014    106208
        270 2015    106291
        200 2005   3761143
        200 2006   3749653
        200 2007   3738549
        200 2008   3728126
        200 2009   3718473
        200 2010   3709671
        200 2011   3701997
        200 2012   3695674
        200 2013   3690591
        200 2014   3686517
        200 2015   3683238
         94 2005     56953
         94 2006     56958
         94 2007     56896
         94 2008     56788
         94 2009     56663
         94 2010     56546
         94 2011     56441
         94 2012     56344
         94 2013     56265
         94 2014     56211
         94 2015     56186
         76 2005     48337
         76 2006     48505
         76 2007     48599
         76 2008     48629
         76 2009     48613
         76 2010     48567
         76 2011     48492
         76 2012     48393
         76 2013     48292
         76 2014     48221
         76 2015     48199
         39 2005  32253092
         39 2006  32610984
         39 2007  32985806
         39 2008  33369898
         39 2009  33752618
         39 2010  34126240
         39 2011  34499905
         39 2012  34868151
         39 2013  35230612
         39 2014  35587793
         39 2015  35939927
         22 2005     65124
         22 2006     65064
         22 2007     64891
         22 2008     64627
         22 2009     64306
         22 2010     63954
         22 2011     63578
         22 2012     63179
         22 2013     62773
         22 2014     62376
         22 2015     62004
         24 2005    329088
         24 2006    335622
         24 2007    342049
         24 2008    348340
         24 2009    354492
         24 2010    360498
         24 2011    366711
         24 2012    372388
         24 2013    377841
         24 2014    383054
         24 2015    388019
         57 2005  11292078
         57 2006  11301100
         57 2007  11301674
         57 2008  11296355
         57 2009  11288826
         57 2010  11281768
         57 2011  11323570
         57 2012  11342631
         57 2013  11362505
         57 2014  11379111
         57 2015  11389562
        106 2005   9260879
        end
        label values country country
        label def country 22 "BER", modify
        label def country 24 "BHM", modify
        label def country 39 "CAN", modify
        label def country 57 "CUB", modify
        label def country 76 "FAE", modify
        label def country 94 "GLD", modify
        label def country 106 "HAI", modify
        label def country 200 "PTR", modify
        label def country 269 "USA", modify
        label def country 270 "USV", modify
        As mentioned earlier, I'd like to create a variable that stores the average population growth rate per country across 2005-2015. By 'average population growth rate', I mean the following:

        USA population in 2015 - USA population in 2014 = annual population growth

        +

        USA population in 2014 - USA population in 2013 = annual population growth

        And so on and so forth (for every country). Then I mean to sum each annual population growth and divide by the number of years (10) to obtain the average. I'm just not sure what the syntax would be for creating a variable that generates and stores all of this information. Help on this would be much appreciated. Let me know if anything is still unclear. Thanks again!

        Comment


        • #5
          If you want absolute changes, the following will do
          Code:
          . bysort country (YEAR): gen change = TOTPP[_n] - TOTPP[_n-1]
          (10 missing values generated)
          
          . list in 1/5
          
               +---------------------------------+
               | country   YEAR   TOTPP   change |
               |---------------------------------|
            1. |     BER   2005   65124        . |
            2. |     BER   2006   65064      -60 |
            3. |     BER   2007   64891     -173 |
            4. |     BER   2008   64627     -264 |
            5. |     BER   2009   64306     -321 |
               +---------------------------------+
          The code sorts by country and makes sure within country the data are sorted by year. Each country will have the first observation missing. For BER we don't know the change from 2004 to 2005. Obviously this country is losing population.

          In demography interest often centers in relative change. For example BER is loosing population at an average rate of half a percent per year, which you can obtain as log(62004/65124)/10 = -0.0049. This may be more meaningful than an average absolute change, and can be calculated as

          Code:
          . bysort country (YEAR): gen rate = log(TOTPP[_N]/TOTPP[1])/(YEAR[_N]-YEAR[1])
          (1 missing value generated)
          
          . egen tag = tag(country)
          
          . list country rate if tag
          
               +---------------------+
               | country        rate |
               |---------------------|
            1. |     BER   -.0049094 |
           12. |     BHM    .0164729 |
           23. |     CAN    .0108235 |
           34. |     CUB    .0008596 |
           45. |     FAE   -.0002859 |
               |---------------------|
           56. |     GLD   -.0013559 |
           67. |     HAI           . |
           68. |     PTR   -.0020931 |
           79. |     USA    .0083017 |
           90. |     USV     -.00138 |
               +---------------------+
          We get a missing value for HAI because it has only one observation. You may find a handout on growth rates here

          Comment

          Working...
          X