PopulationPyramidGER

PopulationPyramidGER preview image

1 collaborator

Default-person Rainer Walke (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.2 • Viewed 163 times • Downloaded 10 times • Run 0 times
Download the 'PopulationPyramidGER' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; pyramid
;; $Id: PopulationPyramidGER.nlogo 42 2018-10-04 06:41:32Z Walke $
;; Rainer Walke, Daniel Ciganda, Sebastian Klüsener MPIDR

globals [Year Age Female Male maxFemale maxMale baselineASFR mxFemale mxMale Total MigInFemale MigOutFemale MigInMale MigOutMale]

patches-own [pAge pFemale pFemaleTemp pMale pMaleTemp pmxFemale pmxMale pDeathFemale pDeathMale pASFR pChildren
  pMigInFemale pMigOutFemale pMigInMale pMigOutMale]

to setup
  clear-all

  set Year 2013

  ;; Germany 2013 Age
  set Age [ 0  1  2  3  4  5  6  7  8  9
    10  11  12  13  14  15  16  17  18  19
    20  21  22  23  24  25  26  27  28  29
    30  31  32  33  34  35  36  37  38  39
    40  41  42  43  44  45  46  47  48  49
    50  51  52  53  54  55  56  57  58  59
    60  61  62  63  64  65  66  67  68  69
    70  71  72  73  74  75  76  77  78  79
    80  81  82  83  84  85  86  87  88  89
    90  91  92  93  94  95  96  97  98  99
    100  101  102  103  104  105  106  107  108  109
    110  ]
  ;; Germany 2013 Female
  set Female [
    328424  324398  333776  328157  338176
    337377  330494  336208  345307  345772
    351900  360084  377333  377762  386794
    399231  392199  380842  387726  405897
    418170  438410  485243  484370  499927
    492943  489744  475815  476747  481999
    495268  496479  499255  476648  470965
    467494  460737  447891  456664  461881
    501782  553128  574871  617164  647571
    667014  686405  688004  703098  698645
    679132  672380  650605  633395  599063
    587365  572893  558701  552881  537307
    536691  526007  525646  506993  461711
    435041  379811  336545  447193  452372
    437776  533179  560362  549981  507450
    469763  449952  427405  388458  305692
    296941  293235  297883  276704  258276
    230890  215518  196367  168348  146051
    129553  112803  90585  54449  26702
    19405  15771  14556  13315  8690
    5450  3252  1843  1014  574
    261  122  53  27  10
    6  ]

  ;; Germany 2013 Male
  set Male [
    345987  341450  350534  345843  355497
    355946  349430  354047  363634  364094
    371262  380625  397086  398743  406763
    419850  413981  401881  409325  427173
    436659  457637  506959  504480  522826
    516186  508240  492650  493215  496340
    509069  503976  504384  482236  476846
    473924  464830  453873  459627  465095
    507509  562426  584257  632277  663538
    682713  704379  709241  722309  716393
    691967  680451  656755  639144  603042
    588349  569966  548968  533700  513489
    511566  500160  498521  482106  440203
    409528  354444  306329  407759  411093
    393870  469677  484252  465943  423782
    383067  356626  329803  291345  220938
    205791  194328  187993  166713  148968
    120209  98820  80844  59521  48213
    41270  33238  24614  13857  6500
    4316  3283  2863  2322  1473
    847  420  229  130  46
    23  6  3  2  1
    0  ]

  ;; Baseline Female ASFR - Germany 2013
  set baselineASFR [
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0.00003  0.00036
    0.00125  0.00304  0.00643  0.01166  0.01751
    0.02333  0.02884  0.03469  0.04152  0.05034
    0.06098  0.0711  0.0806  0.08955  0.09613
    0.10149  0.10329  0.09951  0.09351  0.08602
    0.07585  0.06433  0.05297  0.04152  0.0313
    0.02178  0.01366  0.00809  0.00449  0.00229
    0.00109  0.00056  0.00026  0.00013  0.00009
    0.00006  0.00004  0.00002  0.00001  0
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  ]

  ;; Germany 2013 mx Female
  set mxFemale [
    0.002972  0.000271  0.000112  0.000112  0.000078
    0.000094  0.000087  0.000066  0.000079  0.000058
    0.00006  0.000056  0.000087  0.000079  0.000115
    0.000138  0.000157  0.000166  0.000182  0.000203
    0.000209  0.000181  0.00016  0.000227  0.000216
    0.000226  0.000222  0.000226  0.000246  0.00029
    0.000292  0.000306  0.000355  0.00039  0.000391
    0.000446  0.000454  0.000533  0.000589  0.000646
    0.000747  0.000729  0.000864  0.000953  0.001068
    0.001161  0.001345  0.001529  0.001636  0.001825
    0.002018  0.002405  0.002601  0.002989  0.003104
    0.003545  0.003846  0.003962  0.004465  0.004884
    0.005115  0.005682  0.006171  0.006851  0.007653
    0.008121  0.009041  0.009195  0.010789  0.011371
    0.012127  0.013243  0.013784  0.01617  0.017622
    0.019949  0.02318  0.026469  0.031616  0.035494
    0.041041  0.047187  0.055744  0.064031  0.07416
    0.084419  0.098077  0.113474  0.130757  0.148093
    0.167352  0.191227  0.211485  0.25834  0.230578
    0.285676  0.330631  0.343762  0.410442  0.407152
    0.446375  0.487612  0.52139  0.559208  0.608025
    0.633877  0.633759  0.570523  0.821505  0.91607
    1.117037  ]

  ;; Germany 2013 mx Male
  set mxMale [
    0.003644  0.000307  0.000166  0.000135  0.000097
    0.000117  0.000077  0.000097  0.00008  0.000124
    0.000062  0.000061  0.00008  0.000095  0.000099
    0.00016  0.000238  0.000282  0.000443  0.000453
    0.000435  0.000446  0.000426  0.000467  0.000461
    0.000516  0.000544  0.000478  0.00057  0.000572
    0.000658  0.000641  0.000669  0.000704  0.000814
    0.000857  0.000836  0.000881  0.001014  0.001201
    0.001217  0.001306  0.001459  0.001688  0.001818
    0.002098  0.002403  0.002556  0.00293  0.00334
    0.003595  0.004281  0.004751  0.005344  0.005982
    0.00655  0.007056  0.007974  0.008871  0.009478
    0.01048  0.011193  0.011982  0.013041  0.014119
    0.015249  0.016663  0.017911  0.020125  0.021197
    0.022404  0.025119  0.026439  0.02989  0.032203
    0.035366  0.040286  0.044649  0.051918  0.056072
    0.063882  0.07311  0.084006  0.094824  0.106097
    0.117804  0.130485  0.148224  0.166583  0.185359
    0.204738  0.234709  0.254843  0.308031  0.259591
    0.344735  0.378649  0.392058  0.493306  0.475073
    0.602986  0.59679  0.507168  0.68606  0.689942
    1.087985  0.831354  0.495868  2.598477  2.554945
    6  ]

;; Germany 2013 MigIn Female
set MigInFemale [
 3126  6509  6181  5789  5546
 5341  4782  4469  4043  4056
 3857  3522  3470  3364  3101
 3223  3914  4007  7208  12636
 16914  19982  21212  22173  20902
 19594  17285  15876  14670  13471
 12627  12088  11086  10415  9607
 9374  8589  8270  7953  7568
 7160  7006  6585  6408  6381
 6187  5669  4854  4833  4604
 4542  4033  3876  3752  3403
 3226  2923  2550  2364  2127
 1872  1643  1526  1383  1256
 1155  965  804  623  622
 576  532  489  474  455
 380  350  324  308  250
 220  200  167  176  157
 122  94  89  58  50
 39  34  27  16  8
 6  4  4  4  3
 2  2  0  0  0
 0  0  0  0  0
 0  ]

;; Germany 2013 MigOut Female
set MigOutFemale [
 908  2645  2883  2833  2799
 2680  2872  2316  1908  1896
 1827  1648  1589  1531  1421
 1375  1702  1946  2893  5125
 7610  11331  12907  13063  12485
 12024  10703  9877  9093  8403
 8075  7549  7220  6690  6037
 5885  5538  5284  5174  4862
 4549  4558  4379  4236  4141
 4175  3920  3385  3439  3252
 3159  2965  2827  2777  2488
 2423  2244  2054  1912  1748
 1592  1536  1413  1435  1270
 1286  1179  907  794  716
 720  664  632  617  537
 497  494  420  360  329
 326  282  221  216  226
 177  134  124  95  95
 109  96  75  46  21
 17  13  13  13  8
 4  4  0  0  0
 0  0  0  0  0
 0  ]

;; Germany 2013 MigIn Male
set MigInMale [
 3416  6812  6403  6188  5815
 5523  5029  4637  4299  4251
 4109  3865  3659  3638  3569
 3758  4901  5044  9485  15338
 18448  22102  24716  27470  27530
 27678  26409  25667  24290  22962
 21796  21106  19889  19907  18597
 17682  17621  16654  16207  15568
 14132  14006  13413  13213  12585
 12266  11362  9932  9342  9078
 8314  7597  7111  6848  6036
 5508  4880  4388  3717  3139
 2609  2130  1912  1581  1385
 1357  1091  961  763  727
 631  644  606  552  461
 402  342  289  231  212
 170  131  107  109  89
 75  67  52  32  23
 29  24  17  9  5
 3  2  2  2  1
 1  0  0  0  0
 0  0  0  0  0
 0  ]

;; Germany 2013 MigOut Male
set MigOutMale [
 909  2829  3033  3061  2855
 2875  2981  2443  2153  2022
 1976  1806  1620  1618  1554
 1548  1836  2011  3102  5651
 8687  12211  14543  15774  16603
 16950  16657  16573  15820  15507
 15035  15027  14390  14210  13678
 13040  12977  12492  12187  11654
 10825  10648  10230  10234  9932
 9482  8941  8036  7579  7302
 6935  6186  5919  5679  5106
 4772  4233  3850  3372  2875
 2442  2064  1830  1749  1649
 1778  1562  1210  1062  974
 964  877  866  834  737
 637  591  488  393  336
 342  244  203  219  170
 132  117  88  72  60
 66  53  38  21  11
 6  4  4  4  2
 2  0  0  0  0
 0  0  0  0  0
 0  ]


  set maxFemale 800000
  set maxMale 800000


  ask patches [
    set pAge item pycor Age
    set pFemale item pycor Female
    set pMale item pycor Male
    set pASFR item pycor baselineASFR
    set pmxFemale item pycor mxFemale
    set pmxMale item pycor mxMale
    set pmxMale item pycor mxMale
    set pMigInFemale item pycor MigInFemale
    set pMigOutFemale item pycor MigOutFemale
    set pMigInMale item pycor MigInMale
    set pMigOutMale item pycor MigOutMale
  ]

  create-y-line-labels

  set Total round( sum [pFemale + pMale] of patches with [pxcor = 0] )

  ask patches with [pxcor = 0] [ set pcolor white - 2 ]
  reset-ticks

  ask patches with [pxcor = 0 and pycor = (Year + ticks - cohort) ] [ set pcolor yellow ]

  ask patches with [pxcor < 0] [
    ifelse (( pMale / maxMale ) > ( pxcor / -50)) [ set pcolor 104 ] [set pcolor 0]
  ]

  ask patches with [pxcor > 0] [
    ifelse (( pFemale / maxFemale ) > ( pxcor / 50)) [ set pcolor 14 ] [ set pcolor 0]
  ]


  output-print Year + ticks
end 

;; display y values

to create-y-line-labels
  ask patches with [pxcor = 2]
    [
      set plabel-color black
      if pycor = 0 [ set plabel 0 ]
      if pycor = 10 [ set plabel 10 ]
      if pycor = 20 [ set plabel 20 ]
      if pycor = 30 [ set plabel 30 ]
      if pycor = 40 [ set plabel 40 ]
      if pycor = 50 [ set plabel 50 ]
      if pycor = 60 [ set plabel 60 ]
      if pycor = 70 [ set plabel 70 ]
      if pycor = 80 [ set plabel 80 ]
      if pycor = 90 [ set plabel 90 ]
      if pycor = 100 [ set plabel 100 ]
      if pycor = 110 [ set plabel 110 ]
  ]
  ask patches with [pxcor = -2]
    [
      set plabel-color black
      if pycor = 5 [ set plabel 5 ]
      if pycor = 15 [ set plabel 15 ]
      if pycor = 25 [ set plabel 25 ]
      if pycor = 35 [ set plabel 35 ]
      if pycor = 45 [ set plabel 45 ]
      if pycor = 55 [ set plabel 55 ]
      if pycor = 65 [ set plabel 65 ]
      if pycor = 75 [ set plabel 75 ]
      if pycor = 85 [ set plabel 85 ]
      if pycor = 95 [ set plabel 95 ]
      if pycor = 105 [ set plabel 105 ]
  ]
end 

to boost20
  ask patches with [pycor = 20] [
    set pFemale ( pFemale * 1.2)
    set pMale ( pMale * 1.2)
    ask patches with [pxcor < 0 and pycor = 20] [
      ifelse (( pMale / maxMale ) > ( pxcor / -50)) [ set pcolor 104 ] [set pcolor 0]
    ]

    ask patches with [pxcor > 0 and pycor = 20] [
      ifelse (( pFemale / maxFemale ) > ( pxcor / 50)) [ set pcolor 14 ] [ set pcolor 0]
    ]
  ]
  set Total round( sum [pFemale + pMale] of patches with [pxcor = 0] )
end 

to boost2013
  ask patches [
    set pFemale ( pFemale + pMigInFemale - pMigOutFemale)
    set pMale ( pMale  + pMigInMale - pMigOutMale)
  ]
  ask patches with [pxcor < 0] [
    ifelse (( pMale / maxMale ) > ( pxcor / -50)) [ set pcolor 104 ] [set pcolor 0]
  ]

  ask patches with [pxcor > 0] [
    ifelse (( pFemale / maxFemale ) > ( pxcor / 50)) [ set pcolor 14 ] [ set pcolor 0]
  ]
  set Total round( sum [pFemale + pMale] of patches with [pxcor = 0] )
end 

to set1
  set yearly_increase_20 FALSE
  set yearly_increase FALSE
  set mortality 1.0
  set number_of_children 1.42
  set cohort 1969
end 

to go-once
  go
end 

to go

  if yearly_increase_20 [ boost20 ]

  if yearly_increase [boost2013]

  ;; modify fertility
  ask patches [
    set pASFR ( ( item pycor baselineASFR ) * number_of_children / sum (baselineASFR) )
  ]

  ;; compute the number of newborn children depending on the number of women and the ASFR
  ask patches [
    set pChildren round( pASFR * pFemale )
  ]

  ;; compute the number of death for each age
  ask patches [
    set pDeathFemale ceiling( pmxFemale * pFemale )
    set pDeathMale ceiling( pmxMale * pMale )
  ]
  ask patches [
    set pMale max (list 0  ( pMale - pDeathMale ) )
    set pFemale max ( list 0 ( pFemale - pDeathFemale ) )
  ]

  ask patches with [pycor > 0] [
    set pMaleTemp [pMale] of patch pxcor (pycor - 1)
    set pFemaleTemp [pFemale] of patch pxcor (pycor - 1)
  ]
  ask patches with [pycor = 0] [
    set pMaleTemp round(( sum [pChildren] of patches with [pxcor = 0] ) / 2)
    set pFemaleTemp round(( sum [pChildren] of patches with [pxcor = 0] ) / 2)
  ]

  ask patches [
    set pMale pMaleTemp
    set pFemale pFemaleTemp
  ]

  ask patches with [pxcor < 0] [
    ifelse (( pMale / maxMale ) > ( pxcor / -50)) [ set pcolor 104 ] [set pcolor 0]
  ]

  ask patches with [pxcor > 0] [
    ifelse (( pFemale / maxFemale ) > ( pxcor / 50)) [ set pcolor 14 ] [ set pcolor 0]
  ]
  tick

  ;; modify mortality
  ask patches [
    set pmxMale ( pmxMale * mortality )
    set pmxFemale ( pmxFemale * mortality )
  ]


  ask patches with [pxcor = 0 ] [ set pcolor white - 2 ]
  ask patches with [pxcor = 0 and pycor = (Year + ticks - cohort) ] [ set pcolor yellow ]
  set Total round( sum [pFemale + pMale] of patches with [pxcor = 0] )

  output-print Year + ticks
end 

There is only one version of this model, created over 5 years ago by Rainer Walke.

Attached files

File Type Description Last updated
PopulationPyramidGER.png preview Preview for 'PopulationPyramidGER' over 5 years ago, by Rainer Walke Download

This model does not have any ancestors.

This model does not have any descendants.