Announcement

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

  • Covid Visualization Replication

    Hello,

    Hope you all are doing well.

    I am trying to replicate a visualization in Stata that I saw recently on The Economist and was wondering if someone from the community can help me out. The visualization is as below:

    Click image for larger version

Name:	Untitled-1.jpg
Views:	1
Size:	230.9 KB
ID:	1607988



    I managed to acquire the dataset for this and did some cleaning to make the numbers consistent with the visual. The data is as below:


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str31 region byte days int year byte month long total_deaths float(expected_deaths excess_deaths_pct_change yrmth)
    "Albania"                31 2020  1   2187 2382.3752   -.08200862 202001
    "Albania"                29 2020  2   2018 2009.2384   .004360674 202002
    "Albania"                31 2020  3   1993 1954.4503    .01972404 202003
    "Albania"                30 2020  4   1804 1722.1003    .04755801 202004
    "Albania"                31 2020  5   1803 1672.2504    .07818785 202005
    "Albania"                30 2020  6   1779 1602.1003    .11041734 202006
    "Albania"                31 2020  7   2166 1738.4503    .24593723 202007
    "Albania"                31 2020  8   2476 1681.8503     .4721881 202008
    "Albania"                30 2020  9   1982 1506.3003     .3158067 202009
    "Albania"                31 2020 10   2403 1638.2504     .4668088 202010
    "Albania"                30 2020 11   3854 1738.7003     1.216598 202011
    "Albania"                31 2020 12   3140 2018.2504      .555803 202012
    "Armenia"                31 2020  1   2567  2586.883  -.007686194 202001
    "Armenia"                29 2020  2   2434 2338.0742     .0410277 202002
    "Armenia"                31 2020  3   2288 2312.8599  -.010748573 202003
    "Armenia"                30 2020  4   2156 2088.0708   .032531984 202004
    "Armenia"                31 2020  5   2103   2117.66  -.006922708 202005
    "Armenia"                30 2020  6   2869  1945.871     .4744041 202006
    "Armenia"                31 2020  7   2719   2014.86    .34947345 202007
    "Armenia"                31 2020  8   2106   1946.46     .0819642 202008
    "Armenia"                30 2020  9   2042  1679.271     .2160039 202009
    "Armenia"                31 2020 10   3632   1978.46     .8357713 202010
    "Armenia"                30 2020 11   6060  2184.471     1.774127 202011
    "Armenia"                31 2020 12   4395 2321.8599      .892879 202012
    "Armenia"                31 2021  1   3295  2541.303    .29657882 202101
    "Armenia"                28 2021  2   2665  2216.282    .20246437 202102
    "Azerbaijan"             31 2020  1   5177  5292.724   -.02186468 202001
    "Azerbaijan"             29 2020  2   5039  5115.408  -.014936872 202002
    "Azerbaijan"             31 2020  3   5792 4666.8687     .2410892 202003
    "Azerbaijan"             30 2020  4   4511  4948.479   -.08840679 202004
    "Azerbaijan"             31 2020  5   4294 4741.6685    -.0944116 202005
    "Azerbaijan"             30 2020  6   6203 4203.2793     .4757526 202006
    "Azerbaijan"             31 2020  7   6410 4848.8687     .3219579 202007
    "Azerbaijan"             31 2020  8   5049 4573.8687    .10387959 202008
    "Azerbaijan"             30 2020  9   4520  4182.679    .08064708 202009
    "Azerbaijan"             31 2020 10   5774 4466.6685    .29268605 202010
    "Azerbaijan"             30 2020 11   8378  4580.079      .829226 202011
    "Azerbaijan"             31 2020 12  14500 4787.0684    2.0289936 202012
    "Belarus"                31 2020  1  10725  11317.06   -.05231572 202001
    "Belarus"                29 2020  2   9622 10075.752   -.04503409 202002
    "Belarus"                31 2020  3  10690 10769.473  -.007379394 202003
    "Belarus"                30 2020  4  10886 10227.605   .064374276 202004
    "Belarus"                31 2020  5  11966 10270.072      .165133 202005
    "Belarus"                30 2020  6  13016  9316.205     .3971354 202006
    "Bolivia"                31 2020  1   4805 4589.9883    .04684365 202001
    "Bolivia"                29 2020  2   4463 4279.7344    .04282168 202002
    "Bolivia"                31 2020  3   4247  4541.586   -.06486409 202003
    "Bolivia"                31 2020  5   3754 4557.3857   -.17628217 202005
    "Bolivia"                30 2020  6   8841 4718.4443     .8737108 202006
    "Bolivia"                31 2020  7  17427 4773.3857     2.650868 202007
    "Bolivia"                31 2020  8  12291  4641.986    1.6477892 202008
    "Bosnia and Herzegovina" 31 2020  1   2800  3263.214   -.14195023 202001
    "Bosnia and Herzegovina" 29 2020  2   3203  3347.816   -.04325685 202002
    "Bosnia and Herzegovina" 31 2020  3   2970  3323.257   -.10629838 202003
    "Bosnia and Herzegovina" 30 2020  4   3207    2971.3     .0793255 202004
    "Bosnia and Herzegovina" 31 2020  5   2938  2955.857  -.006041163 202005
    "Bosnia and Herzegovina" 30 2020  6   2953    2724.9    .08370944 202006
    "Bosnia and Herzegovina" 31 2020  7   3066  2766.057     .1084371 202007
    "Bosnia and Herzegovina" 31 2020  8   3329  2810.857     .1843364 202008
    "Bosnia and Herzegovina" 30 2020  9   3459    2629.9     .3152591 202009
    "Bosnia and Herzegovina" 31 2020 10   3506  2971.857    .17973383 202010
    "Bosnia and Herzegovina" 30 2020 11   5410    2896.3     .8679003 202011
    "Bosnia and Herzegovina" 31 2020 12   5962  3026.457     .9699604 202012
    "Brazil"                 31 2020  1 112703 112092.47   .005446706 202001
    "Brazil"                 29 2020  2 105340  104079.8   .012107966 202002
    "Brazil"                 31 2020  3 118955 113148.16    .05132069 202003
    "Brazil"                 30 2020  4 124349  113120.3    .09926333 202004
    "Brazil"                 31 2020  5 154135 120356.76    .28065097 202005
    "Brazil"                 30 2020  6 149310  119947.3    .24479665 202006
    "Brazil"                 31 2020  7 153984 124428.76     .2375274 202007
    "Brazil"                 31 2020  8 145072 118182.55    .22752462 202008
    "Brazil"                 30 2020  9 138293  111529.7    .23996566 202009
    "Brazil"                 31 2020 10 134198 112987.96     .1877195 202010
    "Brazil"                 30 2020 11 125366  106985.9    .17179926 202011
    "Brazil"                 31 2020 12 142003 113169.96    .25477645 202012
    "Brazil"                 31 2021  1 147516 113682.32    .29761603 202101
    "Brazil"                 28 2021  2 135348 101926.84     .3278936 202102
    "Brazil"                 31 2021  3 200975    114738     .7515991 202103
    "Costa Rica"             31 2020  1   2160 2205.0593   -.02043451 202001
    "Costa Rica"             29 2020  2   1914 1913.5175 .00025217567 202002
    "Costa Rica"             31 2020  3   2003  2066.071    -.0305271 202003
    "Costa Rica"             30 2020  4   1881 2019.6818   -.06866516 202004
    "Costa Rica"             31 2020  5   1862 2098.6711   -.11277191 202005
    "Costa Rica"             30 2020  6   1857 2097.4817   -.11465261 202006
    "Costa Rica"             31 2020  7   2059 2091.2712  -.015431362 202007
    "Costa Rica"             31 2020  8   2273  2114.071    .07517667 202008
    "Costa Rica"             30 2020  9   2536 2059.2817    .23149733 202009
    "Costa Rica"             31 2020 10   2467 2144.4712    .15040018 202010
    "Costa Rica"             30 2020 11   2300 2135.4817    .07704034 202011
    "Costa Rica"             31 2020 12   2897 2342.4712    .23672813 202012
    "Ecuador"                31 2020  1   6713  6827.022   -.01670164 202001
    "Ecuador"                29 2020  2   6062  6165.761  -.016828587 202002
    "Ecuador"                31 2020  3  10054  6493.534     .5483095 202003
    "Ecuador"                30 2020  4  21042  6127.936    2.4337826 202004
    "Ecuador"                31 2020  5  10140  6101.534     .6618772 202005
    "Ecuador"                30 2020  6   9015  5997.936    .50301707 202006
    "Ecuador"                31 2020  7  10859  6213.534     .7476368 202007
    "Ecuador"                31 2020  8  10066  6353.534     .5843152 202008
    "Ecuador"                30 2020  9   8010  6185.436    .29497746 202009
    "Ecuador"                31 2020 10   7582  5998.534    .26397556 202010
    "Ecuador"                30 2020 11   7374  6070.936    .21463975 202011
    "Ecuador"                31 2020 12   7662  6615.034    .15827075 202012
    "Ecuador"                31 2021  1   9445  6973.711      .354372 202101
    "Ecuador"                28 2021  2   8793  6085.642     .4448763 202102
    "Ecuador"                31 2021  3  10241  6640.223     .5422675 202103
    "Egypt"                  31 2020  1  57039  58231.23     -.020474 202001
    "Egypt"                  29 2020  2  49779  49510.77   .005417706 202002
    "Egypt"                  31 2020  3  48353  45942.87    .05245925 202003
    "Egypt"                  30 2020  4  42228   42286.5 -.0013832963 202004
    "Egypt"                  31 2020  5  56380  43484.47     .2965548 202005
    "Egypt"                  30 2020  6  78777   43017.7     .8312697 202006
    "Egypt"                  31 2020  7  61100  47146.07    .29597226 202007
    "Egypt"                  31 2020  8  55856  49496.87    .12847537 202008
    "Egypt"                  30 2020  9  49309  42436.29    .16195346 202009
    "Egypt"                  31 2020 10  45958  42805.27    .07365282 202010
    "Egypt"                  30 2020 11  50200   43580.7     .1518862 202011
    "El Salvador"            31 2020  1   3553  3580.593  -.007706326 202001
    "El Salvador"            29 2020  2   3166  3210.064   -.01372682 202002
    "El Salvador"            31 2020  3   2998  3414.312   -.12193141 202003
    "El Salvador"            30 2020  4   2762  3292.805   -.16120148 202004
    "El Salvador"            31 2020  5   3284  3491.912   -.05954098 202005
    "El Salvador"            30 2020  6   6150  3707.405     .6588422 202006
    "El Salvador"            31 2020  7   8484  3615.112    1.3468153 202007
    "El Salvador"            31 2020  8   4971  3509.512     .4164363 202008
    "Georgia"                31 2020  1   4630 4601.0313   .006296187 202001
    "Georgia"                29 2020  2   4136  4033.834    .02532718 202002
    "Georgia"                31 2020  3   4001 4158.2373   -.03781344 202003
    "Georgia"                30 2020  4   3644  3901.726   -.06605445 202004
    "Georgia"                31 2020  5   3860  3827.437   .008507715 202005
    "Georgia"                30 2020  6   3523  3490.926  .0091877105 202006
    "Georgia"                31 2020  7   3706  3410.637    .08660045 202007
    "Georgia"                31 2020  8   3361  3491.437   -.03735919 202008
    "Georgia"                30 2020  9   3299  3147.726    .04805806 202009
    "Georgia"                31 2020 10   4085  3599.637    .13483657 202010
    "Georgia"                30 2020 11   5929 3832.5264     .5470213 202011
    "Georgia"                31 2020 12   6363  4230.037    .50424206 202012
    "Jakarta"                31 2020  1   3303   2951.34    .11915274 202001
    "Jakarta"                29 2020  2   2744   2865.19   -.04229736 202002
    "Jakarta"                31 2020  3   4422   3104.51     .4243795 202003
    "Jakarta"                30 2020  4   4550 3023.6384    .50480956 202004
    "Jakarta"                31 2020  5   4355   2906.01     .4986185 202005
    "Jamaica"                31 2020  1   1568 1681.6942   -.06760698 202001
    "Jamaica"                29 2020  2   1409  1583.563   -.11023436 202002
    "Jamaica"                31 2020  3   1497  1652.233   -.09395353 202003
    "Jamaica"                30 2020  4   1457   1500.49  -.028983943 202004
    "Jamaica"                31 2020  5   1423  1528.033   -.06873747 202005
    "Jamaica"                30 2020  6   1479   1535.29  -.036664158 202006
    "Jamaica"                31 2020  7   1513  1624.633   -.06871282 202007
    "Jamaica"                31 2020  8   1619  1534.833     .0548378 202008
    "Jamaica"                30 2020  9   1642   1510.69    .08692046 202009
    "Jamaica"                31 2020 10   1609  1536.833    .04695817 202010
    "Jamaica"                30 2020 11   1547   1496.89    .03347599 202011
    "Japan"                  31 2020  1 132622 138467.78   -.04221758 202001
    "Japan"                  29 2020  2 115554 123139.38   -.06159992 202002
    "Japan"                  31 2020  3 117979 123190.33   -.04230307 202003
    "Japan"                  30 2020  4 112407 113311.15  -.007979364 202004
    "Japan"                  31 2020  5 107484 111122.33   -.03274166 202005
    "Japan"                  30 2020  6 100423 102966.55   -.02470269 202006
    "Japan"                  31 2020  7 104849 108300.93  -.031873498 202007
    "Japan"                  31 2020  8 111591 110505.13   .009826428 202008
    "Japan"                  30 2020  9 107468 107592.95 -.0011613304 202009
    "Japan"                  31 2020 10 118038 116330.53   .014677752 202010
    "Japan"                  30 2020 11 118455 119158.75  -.005905995 202011
    "Japan"                  31 2020 12 133185 128426.73    .03705047 202012
    "Japan"                  31 2021  1 140844 140273.81  .0040647816 202101
    "Kazakhstan"             31 2020  1  11867  12076.58  -.017354226 202001
    "Kazakhstan"             29 2020  2  10842 10857.884 -.0014628575 202002
    "Kazakhstan"             31 2020  3   8511 11077.225   -.23166674 202003
    "Kazakhstan"             30 2020  4   4441  11405.42    -.6106237 202004
    "Kazakhstan"             31 2020  5  14358 11130.978    .28991368 202005
    "Kazakhstan"             30 2020  6  14949  10790.03    .38544565 202006
    "Kazakhstan"             31 2020  7  28178  11929.54     1.362036 202007
    "Kazakhstan"             31 2020  8  17835  10431.54     .7097189 202008
    "Kazakhstan"             30 2020  9  13672  10544.28     .2966272 202009
    "Kazakhstan"             31 2020 10  12489  11235.04     .1116116 202010
    "Kazakhstan"             30 2020 11  12388  10609.53     .1676295 202011
    "Kazakhstan"             31 2020 12  13083  10675.79    .22548316 202012
    "Kazakhstan"             31 2021  1  12478  12113.32   .030105596 202101
    "Kazakhstan"             28 2021  2  11186  10516.66    .06364571 202102
    "Kosovo"                 31 2020  1    918  872.7859    .05180436 202001
    "Kosovo"                 29 2020  2    745  801.7018   -.07072676 202002
    "Kosovo"                 31 2020  3    831   828.543  .0029653744 202003
    "Kosovo"                 30 2020  4    481  773.6997    -.3783118 202004
    "Kosovo"                 31 2020  5    778  784.9431  -.008845303 202005
    "Kosovo"                 30 2020  6    629  778.4998    -.1920357 202006
    "Kosovo"                 31 2020  7   1126  700.3431     .6077835 202007
    "Kosovo"                 31 2020  8   1306   763.543     .7104471 202008
    "Kosovo"                 30 2020  9   1216  731.0997     .6632478 202009
    "Kosovo"                 31 2020 10    958  807.9431     .1857271 202010
    "Kosovo"                 30 2020 11   1094  761.0997    .43739375 202011
    "Kosovo"                 31 2020 12   1026   767.743     .3363846 202012
    "Kosovo"                 31 2021  1   1714  881.5002     .9444124 202101
    "Kyrgyzstan"             31 2020  1   3082  3001.703   .026750606 202001
    "Kyrgyzstan"             29 2020  2   2900   2684.75     .0801752 202002
    "Kyrgyzstan"             31 2020  3   2390  2733.243    -.1255809 202003
    "Kyrgyzstan"             30 2020  4   1263  2661.532    -.5254613 202004
    "Kyrgyzstan"             31 2020  5   2919  2754.843    .05958845 202005
    "Kyrgyzstan"             30 2020  6   3559  2591.132     .3735309 202006
    "Kyrgyzstan"             31 2020  7   4045  2858.443      .415106 202007
    "Kyrgyzstan"             31 2020  8   4572  2609.243     .7522323 202008
    "Kyrgyzstan"             30 2020  9   3411  2508.132     .3599762 202009
    "Kyrgyzstan"             31 2020 10   3423  2741.643    .24852134 202010
    "Kyrgyzstan"             30 2020 11   4154  2732.532    .52020174 202011
    "Kyrgyzstan"             31 2020 12   4259  3038.843     .4015202 202012
    "Kyrgyzstan"             31 2021  1   2988  2980.117    .00264519 202101
    "Mauritius"              31 2020  1    965  983.4243  -.018734874 202001
    "Mauritius"              29 2020  2    845  880.5248   -.04034507 202002
    "Mauritius"              31 2020  3    929  972.3092   -.04454262 202003
    "Mauritius"              30 2020  4    850  885.5767   -.04017342 202004
    "Mauritius"              31 2020  5    893  928.7092   -.03845035 202005
    "Mauritius"              30 2020  6    910  892.9766    .01906361 202006
    "Mauritius"              31 2020  7   1006 1074.9092   -.06410699 202007
    "Mauritius"              31 2020  8   1002 1015.9092   -.01369138 202008
    "Mauritius"              30 2020  9    906  988.5767   -.08353084 202009
    "Mauritius"              31 2020 10    932  946.7092  -.015537187 202010
    "Mauritius"              30 2020 11    899  893.9766   .005619115 202011
    "Mauritius"              31 2020 12    923  952.3092  -.030776976 202012
    "Moldova"                31 2020  1   3477  3718.195   -.06486891 202001
    "Moldova"                29 2020  2   3098 3192.8215  -.029698344 202002
    "Moldova"                31 2020  3   2708 3172.2344   -.14634302 202003
    "Moldova"                30 2020  4   2275  2889.349    -.2126255 202004
    "Moldova"                31 2020  5   3873  2984.434    .29773337 202005
    "Moldova"                30 2020  6   3339  2749.549     .2143808 202006
    "Moldova"                31 2020  7   3355 2543.0344     .3192901 202007
    "Moldova"                31 2020  8   2707 2448.0344    .10578514 202008
    "Moldova"                30 2020  9   3467 2613.1494     .3267516 202009
    "Moldova"                31 2020 10   3829 2934.2344     .3049401 202010
    "Moldova"                30 2020 11   3736  3048.349     .2255813 202011
    "Moldova"                31 2020 12   4754 3024.2344    .57196814 202012
    "Mongolia"               31 2020  1   1366  1455.567   -.06153423 202001
    "Mongolia"               29 2020  2   1298 1376.7825    -.0572222 202002
    "Mongolia"               31 2020  3   1292 1496.6807   -.13675639 202003
    "Mongolia"               30 2020  4   1310 1401.9813  -.065608054 202004
    "Mongolia"               31 2020  5   1288 1479.4806   -.12942423 202005
    "Mongolia"               30 2020  6   1306 1385.3812   -.05729922 202006
    "Mongolia"               31 2020  7   1402 1435.0807  -.023051415 202007
    "Mongolia"               31 2020  8   1331 1425.4806   -.06627984 202008
    "Mongolia"               30 2020  9   1405 1445.5813   -.02807263 202009
    "Mongolia"               31 2020 10   1427 1455.6807  -.019702563 202010
    "Mongolia"               30 2020 11   1278 1369.1813  -.066595465 202011
    "Mongolia"               31 2020 12   1219 1551.8806   -.21450144 202012
    "Mongolia"               31 2021  1   1151  1475.194    -.2197637 202101
    "Mongolia"               28 2021  2   1237 1347.0348   -.08168666 202102
    "Mongolia"               31 2021  3   1381 1516.3075   -.08923488 202103
    "Nicaragua"              31 2020  1   2108 2112.4727 -.0021173144 202001
    "Nicaragua"              29 2020  2   1798 1809.8678  -.006557298 202002
    "Nicaragua"              31 2020  3   2759  1976.591     .3958376 202003
    "Nicaragua"              30 2020  4   3240 1982.5477     .6342608 202004
    "Nicaragua"              31 2020  5   3348  1974.091     .6959705 202005
    "Nicaragua"              30 2020  6   3240 1982.2977     .6344669 202006
    "Nicaragua"              31 2020  7   3544  2110.841     .6789517 202007
    "Nicaragua"              31 2020  8   3544  2114.591     .6759742 202008
    "North Macedonia"        31 2020  1   1774 1979.4075   -.10377222 202001
    "North Macedonia"        29 2020  2   1653 1759.2596   -.06040021 202002
    "North Macedonia"        31 2020  3   1674  1760.689   -.04923584 202003
    "North Macedonia"        30 2020  4   1631  1576.254   .034731798 202004
    "North Macedonia"        31 2020  5   1602  1594.489   .004710603 202005
    "North Macedonia"        30 2020  6   1831  1474.454    .24181573 202006
    "North Macedonia"        31 2020  7   1926  1556.689    .23724136 202007
    "North Macedonia"        31 2020  8   1747  1522.289     .1476139 202008
    "North Macedonia"        30 2020  9   1746 1445.6538      .207758 202009
    "North Macedonia"        31 2020 10   1800  1679.489    .07175457 202010
    "North Macedonia"        30 2020 11   3205 1606.6538     .9948292 202011
    "North Macedonia"        31 2020 12   4460  1801.289    1.4760047 202012
    "North Macedonia"        31 2021  1   2149  1965.304     .0934696 202101
    "Oman"                   31 2020  1    817   852.549   -.04169723 202001
    "Oman"                   29 2020  2    696  746.8495   -.06808539 202002
    "Oman"                   31 2020  3    817  817.2587 -.0003165673 202003
    "Oman"                   30 2020  4    694  739.4891    -.0615142 202004
    "Oman"                   31 2020  5    758  745.8587   .016278261 202005
    "Oman"                   30 2020  6    868  731.8891    .18597206 202006
    "Oman"                   31 2020  7   1029  778.2587     .3221824 202007
    "Oman"                   31 2020  8   1007  764.8587      .316583 202008
    "Oman"                   30 2020  9   1073  737.0891     .4557264 202009
    "Oman"                   31 2020 10   1070  758.2587     .4111279 202010
    "Oman"                   30 2020 11    893  748.2891    .19338906 202011
    "Oman"                   31 2020 12    863  820.6587    .05159426 202012
    "Oman"                   31 2021  1    835  872.9019    -.0434205 202101
    "Oman"                   28 2021  2    734  739.4794  -.007409774 202102
    "Panama"                 31 2020  1   2032 1842.6465    .10276175 202001
    "Panama"                 29 2020  2   1531  1607.216   -.04742118 202002
    "Panama"                 31 2020  3   1287 1718.7758    -.2512112 202003
    "Panama"                 30 2020  4     69 1698.6604    -.9593797 202004
    "Panama"                 31 2020  5   2483 1697.1757     .4630188 202005
    "Panama"                 30 2020  6   2284 1739.8604      .312749 202006
    "Panama"                 31 2020  7   2742 1825.3757     .5021565 202007
    "Panama"                 31 2020  8   2668 1779.3757     .4994023 202008
    "Panama"                 30 2020  9   2401 1780.2604     .3486791 202009
    "Panama"                 31 2020 10   2131 1812.1757    .17593454 202010
    "Panama"                 30 2020 11   2108 1736.4603     .2139638 202011
    "Panama"                 31 2020 12   2140 1798.3757     .1899627 202012
    "Paraguay"               31 2020  1   2712  2704.914  .0026197224 202001
    "Paraguay"               29 2020  2   2720  2513.755    .08204672 202002
    "Paraguay"               31 2020  3   2851  2614.097    .09062532 202003
    "Paraguay"               30 2020  4   2410  2557.223   -.05757128 202004
    "Paraguay"               31 2020  5   2512 2857.2966   -.12084732 202005
    "Paraguay"               30 2020  6   2668 3135.8225   -.14918655 202006
    "Paraguay"               31 2020  7   2795 3181.4966   -.12148266 202007
    "Paraguay"               31 2020  8   3238 2972.6965     .0892467 202008
    "Paraguay"               30 2020  9   3235  2723.223     .1879308 202009
    "Paraguay"               31 2020 10   3205 2661.4966    .20420967 202010
    "Paraguay"               30 2020 11   2744 2468.8225      .111461 202011
    "Paraguay"               31 2020 12   3049  2674.897    .13985713 202012
    "Peru"                   31 2020  1  10422  10126.97    .02913316 202001
    "Peru"                   29 2020  2   9779   9737.27  .0042856825 202002
    "Peru"                   31 2020  3  10251  10375.96  -.012043143 202003
    "Peru"                   30 2020  4  13744  9665.219     .4220061 202004
    "Peru"                   31 2020  5  26524  10204.96    1.5991285 202005
    "Peru"                   30 2020  6  27894 10658.552    1.6170535 202006
    "Peru"                   31 2020  7  29423 11174.293    1.6330974 202007
    "Peru"                   31 2020  8  28237  11024.96    1.5611886 202008
    "Peru"                   30 2020  9  17093 10772.552    .58671784 202009
    "Peru"                   31 2020 10  13301 11132.293     .1948123 202010
    "Peru"                   30 2020 11  11914 10387.552    .14694975 202011
    "Peru"                   31 2020 12  13707  10792.96    .26999462 202012
    "Peru"                   31 2021  1  22485  10835.95    1.0750375 202101
    "Peru"                   28 2021  2  29138  10041.87    1.9016508 202102
    "Peru"                   31 2021  3  29703 11084.938    1.6795818 202103
    "Philippines"            31 2020  1  53466  54734.87  -.023182066 202001
    "Philippines"            29 2020  2  46216  49005.74   -.05692688 202002
    "Philippines"            31 2020  3  45748  50904.44   -.10129648 202003
    "Philippines"            30 2020  4  44510  50155.09    -.1125526 202004
    "Philippines"            31 2020  5  50124  52095.64   -.03784656 202005
    "Philippines"            30 2020  6  48403  49003.29  -.012249885 202006
    "Philippines"            31 2020  7  54300  51852.64    .04719835 202007
    "Philippines"            31 2020  8  56620  53558.44    .05716296 202008
    "Philippines"            30 2020  9  53709  52267.48   .027579583 202009
    "Philippines"            31 2020 10  53605  54309.24  -.012967236 202010
    "Philippines"            30 2020 11  49992  51571.29   -.03062333 202011
    "Qatar"                  31 2020  1    192  193.0538  -.005458654 202001
    "Qatar"                  29 2020  2    198  191.1262    .03596479 202002
    "Qatar"                  31 2020  3    221 188.26457     .1738799 202003
    "Qatar"                  30 2020  4    166  185.2044   -.10369314 202004
    "Qatar"                  31 2020  5    238  197.8646     .2028429 202005
    "Qatar"                  30 2020  6    303 182.60443     .6593245 202006
    "Qatar"                  31 2020  7    269 175.06458    .53657585 202007
    "Qatar"                  31 2020  8    209  177.8646     .1750513 202008
    "Qatar"                  30 2020  9    216 181.40443     .1907096 202009
    "Qatar"                  31 2020 10    226 189.06458    .19535877 202010
    "Qatar"                  30 2020 11    168 197.00443   -.14722729 202011
    "Qatar"                  31 2020 12    221 205.46457     .0756112 202012
    "Qatar"                  31 2021  1    212 191.60867    .10642173 202101
    "Qatar"                  28 2021  2    178 183.23035  -.028545164 202102
    "Russia"                 31 2020  1 164075 164841.34  -.004648976 202001
    "Russia"                 29 2020  2 143179 146892.67    -.0252815 202002
    "Russia"                 31 2020  3 152740    157566   -.03062851 202003
    "Russia"                 30 2020  4 150873 146581.92   .029274223 202004
    "Russia"                 31 2020  5 172914 151283.61    .14297906 202005
    "Russia"                 30 2020  6 162758 143380.92      .135144 202006
    "Russia"                 31 2020  7 181479 142604.61     .2726026 202007
    "Russia"                 31 2020  8 157181  142268.4    .10482009 202008
    "Russia"                 30 2020  9 170717 137050.92    .24564643 202009
    "Russia"                 31 2020 10 205456  147349.4     .3943456 202010
    "Russia"                 30 2020 11 219872 139708.53    .57379085 202011
    "Russia"                 31 2020 12 243235 146378.22     .6616886 202012
    "Russia"                 31 2021  1 219769 162360.14     .3535896 202101
    "Russia"                 28 2021  2 172672 139586.33    .23702665 202102
    "Serbia"                 31 2020  1   8706  9512.457   -.08477904 202001
    "Serbia"                 29 2020  2   9122  9342.022  -.023551933 202002
    "Serbia"                 31 2020  3   8189  9109.948    -.1010926 202003
    "Serbia"                 30 2020  4   8625  8323.131   .036268726 202004
    "Serbia"                 31 2020  5   8602  8112.749    .06030653 202005
    "Serbia"                 30 2020  6   8325  7642.131    .08935589 202006
    "Serbia"                 31 2020  7  10023  7922.948    .26505935 202007
    "Serbia"                 31 2020  8   8730  7551.148    .15611555 202008
    "Serbia"                 30 2020  9   8123  7369.331    .10227107 202009
    "Serbia"                 31 2020 10   8353  8319.148   .004069126 202010
    "Serbia"                 30 2020 11  10835  8121.531     .3341081 202011
    "Serbia"                 31 2020 12  17321  9436.548     .8355228 202012
    "Serbia"                 31 2021  1  10417  9460.973    .10104953 202101
    "Serbia"                 28 2021  2  10166  8973.383    .13290614 202102
    "Singapore"              31 2020  1   2085 1932.9728    .07864945 202001
    "Singapore"              29 2020  2   1758  1752.993   .002856174 202002
    "Singapore"              31 2020  3   1890 1896.9673 -.0036728715 202003
    "Singapore"              30 2020  4   1899 1795.4974    .05764564 202004
    "Singapore"              31 2020  5   1872 1916.3673   -.02315178 202005
    "Singapore"              30 2020  6   1757 1886.0974   -.06844684 202006
    "Singapore"              31 2020  7   1752 1941.5673   -.09763623 202007
    "Singapore"              31 2020  8   1858 1889.5673  -.016706109 202008
    "Singapore"              30 2020  9   1746 1739.0974   .003969068 202009
    "Singapore"              31 2020 10   1769 1867.3673     -.052677 202010
    "Singapore"              30 2020 11   1768 1769.0974 -.0006203184 202011
    "Singapore"              31 2020 12   1846 1881.1674   -.01869441 202012
    end

    WIll be great if someone can help out. Thanks in advance!

  • #2
    I have been trying to plot the additional axis however, unable to do so. I am just going to share my plot and graph region design in an attempt to replicate using the following code:

    Code:
    local url = "https://raw.githubusercontent.com/TheEconomist/covid-19-excess-deaths-tracker/master/output-data/excess-deaths/"
    local filemonthly = "all_monthly_excess_deaths.csv"
    local fileweekly = "all_weekly_excess_deaths.csv"
    local fileqtrly = "all_quarterly_excess_deaths.csv"
    
    insheet using "`url'`filemonthly'", clear
    generate monthly = 1
    
    * Keeping Selected regions from each country
    egen tag = tag( country region)
    bysort country: egen count = total(tag)
    generate ctr_reg = 1 if (country==region) & count>1
    drop if count>1 & ctr_reg==.
    drop country tag count ctr_reg
    
    * Generate year month indicator
    encode region, gen(Region)
    bysort Region: generate yrmth = _n
    
    label define yrmth 1 "Jan 2020" 2 "Feb" 3 "Mar" 4 "Apr" 5 "May" 6 "Jun" 7 "Jul" 8 "Aug" 9 "Sep" 10 "Oct" 11 "Nov" 12 "Dec" 13 "Jan 2021" 14 "Feb" 15 "Mar" 16 "Apr"
    label values yrmth yrmth
    
    * Drawing the graph layout
    
    ssc install blindschemes, replace
    
    twoway (scatter Region yrmth, color(white%0) ylabel(1/35, valuelabel angle(horizontal) labgap(-145) labsize(2) noticks) yscale(noline alt reverse) ytitle("") xtitle("") graphregion(margin(25=2)) xlabel(1/16, valuelabel labsize(2))), scheme(plotplain)
    Click image for larger version

Name:	Screenshot 2021-05-06 223311.png
Views:	1
Size:	78.2 KB
ID:	1608060



    I have had numerous failed attempts at plotting the data and would really appreciate if someone can kindly guide me how it is done. Thank you
    Last edited by Fahad Mirza; 06 May 2021, 11:35.

    Comment


    • #3
      Here is some technique to build on, although the command length may be an issue if the number of country-time combinations is too large.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float(country time start end)
      1 1 20 25
      1 2 15 20
      1 3 10 15
      1 4  5 10
      1 5  0  5
      2 1 20 25
      2 2 15 20
      2 3 10 15
      2 4  5 10
      2 5  0  5
      3 1 20 25
      3 2 15 20
      3 3 10 15
      3 4  5 10
      3 5  0  5
      4 1 20 25
      4 2 15 20
      4 3 10 15
      4 4  5 10
      4 5  0  5
      5 1 20 25
      5 2 15 20
      5 3 10 15
      5 4  5 10
      5 5  0  5
      6 1 20 25
      6 2 15 20
      6 3 10 15
      6 4  5 10
      6 5  0  5
      7 1 20 25
      7 2 15 20
      7 3 10 15
      7 4  5 10
      7 5  0  5
      8 1 20 25
      8 2 15 20
      8 3 10 15
      8 4  5 10
      8 5  0  5
      end
      
      
      set seed 05062021
      gen val=runiformint(1,10)
      *SPECIFY COLORS 
      gen color= cond(val<=3, "blue%99", cond(inrange(val, 4, 7), "blue%55", "blue%11"))
      
      local command
      forval i=1/`=_N'{
          local command "`command' (rbar start end country in `i', horiz barw(0.9) lc(white) fc(`=color[`i']'))"
      }
      tw `command', leg(off) scheme(s1color) xlab(0 "Jan" 5 "Feb" 10 "Mar" 15 "Apr" 20 "May" 25 "Jun") ///
      ylab(1(1)8) xtitle("")
      Res.:
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	15.9 KB
ID:	1608079

      Last edited by Andrew Musau; 06 May 2021, 14:11.

      Comment


      • #4
        Andrew Musau firstly thank you for reaching out, much appreciated! and yes you are right i am getting an error "too many options" possibly because there are 35 countries and roughly 12 or so months. The code right now has this form:

        Code:
        local url = "https://raw.githubusercontent.com/TheEconomist/covid-19-excess-deaths-tracker/master/output-data/excess-deaths/"
        local filemonthly = "all_monthly_excess_deaths.csv"
        local fileweekly = "all_weekly_excess_deaths.csv"
        local fileqtrly = "all_quarterly_excess_deaths.csv"
        
        
        insheet using "`url'`filemonthly'", clear
        generate monthly = 1
        
        
        * Keeping Selected regions from each country
        egen tag = tag( country region)
        bysort country: egen count = total(tag)
        generate ctr_reg = 1 if (country==region) & count>1
        drop if count>1 & ctr_reg==.
        drop country tag count ctr_reg
        
        
        * Generate year month indicator
        encode region, gen(Region)
        bysort Region: generate yrmth = _n
        
        label define yrmth 1 "Jan 2020" 2 "Feb" 3 "Mar" 4 "Apr" 5 "May" 6 "Jun" 7 "Jul" 8 "Aug" 9 "Sep" 10 "Oct" 11 "Nov" 12 "Dec" 13 "Jan 2021" 14 "Feb" 15 "Mar" 16 "Apr", replace
        label values yrmth yrmth
        
        
        * Drawing the graph layout
        
        replace excess_deaths_pct_change = round(excess_deaths_pct_change*100,1)
        
        
        generate cat = 0
        replace cat = 1 if (excess_deaths_pct_change>=0 & excess_deaths_pct_change<25)
        replace cat = 2 if (excess_deaths_pct_change>=25 & excess_deaths_pct_change<50)
        replace cat = 3 if (excess_deaths_pct_change>=50 & excess_deaths_pct_change<100)
        replace cat = 4 if (excess_deaths_pct_change>=100 & excess_deaths_pct_change<200)
        replace cat = 5 if (excess_deaths_pct_change>=200)
        
        generate color= "234 242 245" if cat==0
        replace color = "254 239 216" if cat==1
        replace color = "253 204 138" if cat==2
        replace color = "252 140 89" if cat==3
        replace color = "227 73 51" if cat==4
        replace color = "179 0 1" if cat==5
        
        local command
        forval i=1/`=_N'{
            local command "`command' (rbar yrmth yrmth1 Region in `i', legend(off) horiz barw(0.6) bc(`=color[`i']'))"
        }
        
        twoway (scatter Region yrmth, color(white%0) ylabel(1/35, valuelabel angle(horizontal) labgap(-145) labsize(2) noticks) yscale(noline alt reverse) ytitle("") xtitle("") graphregion(margin(25=2)) xlabel(1/16, valuelabel labsize(2))) (rspike yrmth yrmth1 Region, lwidth(1.75) lalign(inside) horizontal legend(off)) `command', scheme(plotplain)
        Isn't it possible to add like another dimension the way heatplot does? It will be interesting if that is possible somehow

        Comment


        • #5
          The "heatplot" package by Ben Jann available through "ssc install heatplot" can be used to achieve the desired output.

          This code can be used to generate the image below
          Code:
          encode region, gen(Region)
          bysort Region: generate time = _n
          heatplot excess_deaths_pct_change region time, xlab(1 "Jan 2020" 2 "Feb" 3 "Mar" 4 "Apr" 5 "May" 6 "Jun" 7 "Jul" 8 "Aug" 9 "Sep" 10 "Oct" 11 "Nov" 12 "Dec" 13 "Jan 2021" 14 "Feb" 15 "Mar" 16 "Apr", labsize(vsmall) nogrid) cuts(-0.9 0.0 0.25 0.50 1.00 2.00 3.00) color(red%0 red%20 red%30 red%40 red%50 red%60 red%80) discrete legend(pos(6) row(1) order(1 "" 2 "0" 3 "+25" 4 "+50" 5 "+100" 6 "+200" 7 "")) ylab(,labsize(vsmall) nogrid) ytitle("") xtitle("")
          Some additional tweaking of the extensive list of options in heatplot should give you the desired results.
          Click image for larger version

Name:	Graph.png
Views:	1
Size:	116.9 KB
ID:	1608117

          Comment


          • #6
            Thanks Tarun Choudhary for the illustration.


            i am getting an error "too many options" possibly because there are 35 countries and roughly 12 or so months. The code right now has this form:
            You can specify the color conditions for a set of range bars. No need to do it one by one as I do in #3.

            Code:
            tw  (rbar start end country if inrange(val, 1, 3), horiz barw(0.9) lc(white) fc(blue%99)) ///
            (rbar start end country if inrange(val, 4, 7), horiz barw(0.9) lc(white) fc(blue%55)) ///
            (rbar start end country if inrange(val, 8, 10), horiz barw(0.9) lc(white) fc(blue%11)), ///
            leg(off) scheme(s1color) xlab(0 "Jan" 5 "Feb" 10 "Mar" 15 "Apr" 20 "May" 25 "Jun") ///
            ylab(1(1)8) xtitle("")

            Comment


            • #7
              Thank you very much Andrew Musau and Tarun Choudhary for helping with these codes. I went along with the heatplot option and was able to make the following visual:

              Click image for larger version

Name:	Screenshot 2021-05-07 151054.png
Views:	1
Size:	49.6 KB
ID:	1608160

              This was made using the following code:

              Code:
              local url = "https://raw.githubusercontent.com/TheEconomist/covid-19-excess-deaths-tracker/master/output-data/excess-deaths/"
              local filemonthly = "all_monthly_excess_deaths.csv"
              local fileweekly = "all_weekly_excess_deaths.csv"
              local fileqtrly = "all_quarterly_excess_deaths.csv"
              
              
              insheet using "`url'`filemonthly'", clear
              generate monthly = 1
              
              
              * Keeping Selected regions from each country
              egen tag = tag( country region)
              bysort country: egen count = total(tag)
              generate ctr_reg = 1 if (country==region) & count>1
              drop if count>1 & ctr_reg==.
              drop country tag count ctr_reg
              
              
              * Generate year month indicator
              encode region, gen(Region)
              bysort Region: generate yrmth = _n
              
              label define yrmth 1 "Jan 2020" 2 "Feb" 3 "Mar" 4 "Apr" 5 "May" 6 "Jun" 7 "Jul" 8 "Aug" 9 "Sep" 10 "Oct" 11 "Nov" 12 "Dec" 13 "Jan 2021" 14 "Feb" 15 "Mar" 16 "Apr", replace
              label values yrmth yrmth
              
              
              * Drawing the graph layout
              
              ssc install blindschemes, replace
              ssc install heatplot, replace
              
              replace excess_deaths_pct_change = round(excess_deaths_pct_change*100,1)
              
              
              heatplot excess_deaths_pct_change i.Region i.yrmth, ytitle("") xtitle("") legend(subtitle("{bf}Deviation from expected deaths, %            ", span size(1.75)) pos(1) rows(1) keygap(0.5) colgap(0) size(1.5) symysize(0.85) symxsize(7) order(1 "" 2 "0" 3 "+25" 4 "+50" 5 "+100" 6 "+200") stack) ylabel(, angle(horizontal) labgap(-145) labsize(2) noticks nogrid) yscale(noline alt reverse) xlabel(, labsize(1.75) tposition(outside) nogrid) graphregion(margin(22=2)) plotregion(margin(b=0 t=0)) color("234 242 245" "254 239 216" "253 204 138" "252 140 89" "227 73 51" "179 0 1") cuts(@min 0 25 50 100 200 @max) p(lcolor(white) lwidth(0.1) lalign(center)) addplot(scatter Region yrmth, color(white%0) xaxis(2) xtitle("", axis(2)) xlabel(1/16, valuelabels labsize(1.75) nogrid axis(2))) scheme(plotplain)
              I feel like I am quite close to the main visual now. However, i need one small assistance if any of you can help with that. So if you look at the bottom axis, the labels are centered to the month block. I am wanting the bottom x-axis to look like the top x-axis however, i am unable to find an option to shift these to the left hand side (or maybe i am looking in the wrong direction). Is there any ways to accomplish this?

              Thank you all once again!

              Comment


              • #8
                I have not tried your example, but it seems to me that

                Code:
                xlab(0.5 "Jan 2020" 1.5 "Feb" 2.5 "Mar"...)

                should do it.

                Comment


                • #9
                  Andrew Musau thank you for this! although just wondering shouldnt there be an option to make this happen? Like if you look at the top axis it by default makes it in that manner. Or Stata does not allow for that

                  Comment


                  • #10
                    With the ticks you can, but the label stands at its exact numerical point. I do not know of an option to offset. So you can either define a new variable with the offset and label it with the value labels of the original x-variable, or leave the labels centered and adjust the ticks.

                    Code:
                    xlabel(1/16, valuelabels noticks) xtick(0.5(1)16.5)
                    See mylabels from SSC by Nick Cox that can simplify the process of explicitly defining labels.

                    Code:
                    ssc install mylabels, replace
                    help mylabels
                    Last edited by Andrew Musau; 07 May 2021, 07:13.

                    Comment


                    • #11
                      Some great answers here, but rather than try to make excellent work slightly better, let's broaden the discussion to other kinds of visualization.

                      I would suggest that alphabetical order of countries has no advantage beyond ease of look-up if a particular country is of interest. What would be better depends on purpose. I chose sd within each panel just as one possibility and the point is more that there are other choices and that myaxis makes choosing a little easier. .

                      This uses fabplot and myaxis both from SSC. (Detail: a minute bug just discovered and now fixed in my version is that -- with the version on SSC -- you mustn't abbreviate variable names in the fabplot call.)

                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input str31 region byte days int year byte month long total_deaths float(expected_deaths excess_deaths_pct_change yrmth)
                      "Albania"                31 2020  1   2187 2382.3752   -.08200862 202001
                      "Albania"                29 2020  2   2018 2009.2384   .004360674 202002
                      "Albania"                31 2020  3   1993 1954.4503    .01972404 202003
                      "Albania"                30 2020  4   1804 1722.1003    .04755801 202004
                      "Albania"                31 2020  5   1803 1672.2504    .07818785 202005
                      "Albania"                30 2020  6   1779 1602.1003    .11041734 202006
                      "Albania"                31 2020  7   2166 1738.4503    .24593723 202007
                      "Albania"                31 2020  8   2476 1681.8503     .4721881 202008
                      "Albania"                30 2020  9   1982 1506.3003     .3158067 202009
                      "Albania"                31 2020 10   2403 1638.2504     .4668088 202010
                      "Albania"                30 2020 11   3854 1738.7003     1.216598 202011
                      "Albania"                31 2020 12   3140 2018.2504      .555803 202012
                      "Armenia"                31 2020  1   2567  2586.883  -.007686194 202001
                      "Armenia"                29 2020  2   2434 2338.0742     .0410277 202002
                      "Armenia"                31 2020  3   2288 2312.8599  -.010748573 202003
                      "Armenia"                30 2020  4   2156 2088.0708   .032531984 202004
                      "Armenia"                31 2020  5   2103   2117.66  -.006922708 202005
                      "Armenia"                30 2020  6   2869  1945.871     .4744041 202006
                      "Armenia"                31 2020  7   2719   2014.86    .34947345 202007
                      "Armenia"                31 2020  8   2106   1946.46     .0819642 202008
                      "Armenia"                30 2020  9   2042  1679.271     .2160039 202009
                      "Armenia"                31 2020 10   3632   1978.46     .8357713 202010
                      "Armenia"                30 2020 11   6060  2184.471     1.774127 202011
                      "Armenia"                31 2020 12   4395 2321.8599      .892879 202012
                      "Armenia"                31 2021  1   3295  2541.303    .29657882 202101
                      "Armenia"                28 2021  2   2665  2216.282    .20246437 202102
                      "Azerbaijan"             31 2020  1   5177  5292.724   -.02186468 202001
                      "Azerbaijan"             29 2020  2   5039  5115.408  -.014936872 202002
                      "Azerbaijan"             31 2020  3   5792 4666.8687     .2410892 202003
                      "Azerbaijan"             30 2020  4   4511  4948.479   -.08840679 202004
                      "Azerbaijan"             31 2020  5   4294 4741.6685    -.0944116 202005
                      "Azerbaijan"             30 2020  6   6203 4203.2793     .4757526 202006
                      "Azerbaijan"             31 2020  7   6410 4848.8687     .3219579 202007
                      "Azerbaijan"             31 2020  8   5049 4573.8687    .10387959 202008
                      "Azerbaijan"             30 2020  9   4520  4182.679    .08064708 202009
                      "Azerbaijan"             31 2020 10   5774 4466.6685    .29268605 202010
                      "Azerbaijan"             30 2020 11   8378  4580.079      .829226 202011
                      "Azerbaijan"             31 2020 12  14500 4787.0684    2.0289936 202012
                      "Belarus"                31 2020  1  10725  11317.06   -.05231572 202001
                      "Belarus"                29 2020  2   9622 10075.752   -.04503409 202002
                      "Belarus"                31 2020  3  10690 10769.473  -.007379394 202003
                      "Belarus"                30 2020  4  10886 10227.605   .064374276 202004
                      "Belarus"                31 2020  5  11966 10270.072      .165133 202005
                      "Belarus"                30 2020  6  13016  9316.205     .3971354 202006
                      "Bolivia"                31 2020  1   4805 4589.9883    .04684365 202001
                      "Bolivia"                29 2020  2   4463 4279.7344    .04282168 202002
                      "Bolivia"                31 2020  3   4247  4541.586   -.06486409 202003
                      "Bolivia"                31 2020  5   3754 4557.3857   -.17628217 202005
                      "Bolivia"                30 2020  6   8841 4718.4443     .8737108 202006
                      "Bolivia"                31 2020  7  17427 4773.3857     2.650868 202007
                      "Bolivia"                31 2020  8  12291  4641.986    1.6477892 202008
                      "Bosnia and Herzegovina" 31 2020  1   2800  3263.214   -.14195023 202001
                      "Bosnia and Herzegovina" 29 2020  2   3203  3347.816   -.04325685 202002
                      "Bosnia and Herzegovina" 31 2020  3   2970  3323.257   -.10629838 202003
                      "Bosnia and Herzegovina" 30 2020  4   3207    2971.3     .0793255 202004
                      "Bosnia and Herzegovina" 31 2020  5   2938  2955.857  -.006041163 202005
                      "Bosnia and Herzegovina" 30 2020  6   2953    2724.9    .08370944 202006
                      "Bosnia and Herzegovina" 31 2020  7   3066  2766.057     .1084371 202007
                      "Bosnia and Herzegovina" 31 2020  8   3329  2810.857     .1843364 202008
                      "Bosnia and Herzegovina" 30 2020  9   3459    2629.9     .3152591 202009
                      "Bosnia and Herzegovina" 31 2020 10   3506  2971.857    .17973383 202010
                      "Bosnia and Herzegovina" 30 2020 11   5410    2896.3     .8679003 202011
                      "Bosnia and Herzegovina" 31 2020 12   5962  3026.457     .9699604 202012
                      "Brazil"                 31 2020  1 112703 112092.47   .005446706 202001
                      "Brazil"                 29 2020  2 105340  104079.8   .012107966 202002
                      "Brazil"                 31 2020  3 118955 113148.16    .05132069 202003
                      "Brazil"                 30 2020  4 124349  113120.3    .09926333 202004
                      "Brazil"                 31 2020  5 154135 120356.76    .28065097 202005
                      "Brazil"                 30 2020  6 149310  119947.3    .24479665 202006
                      "Brazil"                 31 2020  7 153984 124428.76     .2375274 202007
                      "Brazil"                 31 2020  8 145072 118182.55    .22752462 202008
                      "Brazil"                 30 2020  9 138293  111529.7    .23996566 202009
                      "Brazil"                 31 2020 10 134198 112987.96     .1877195 202010
                      "Brazil"                 30 2020 11 125366  106985.9    .17179926 202011
                      "Brazil"                 31 2020 12 142003 113169.96    .25477645 202012
                      "Brazil"                 31 2021  1 147516 113682.32    .29761603 202101
                      "Brazil"                 28 2021  2 135348 101926.84     .3278936 202102
                      "Brazil"                 31 2021  3 200975    114738     .7515991 202103
                      "Costa Rica"             31 2020  1   2160 2205.0593   -.02043451 202001
                      "Costa Rica"             29 2020  2   1914 1913.5175 .00025217567 202002
                      "Costa Rica"             31 2020  3   2003  2066.071    -.0305271 202003
                      "Costa Rica"             30 2020  4   1881 2019.6818   -.06866516 202004
                      "Costa Rica"             31 2020  5   1862 2098.6711   -.11277191 202005
                      "Costa Rica"             30 2020  6   1857 2097.4817   -.11465261 202006
                      "Costa Rica"             31 2020  7   2059 2091.2712  -.015431362 202007
                      "Costa Rica"             31 2020  8   2273  2114.071    .07517667 202008
                      "Costa Rica"             30 2020  9   2536 2059.2817    .23149733 202009
                      "Costa Rica"             31 2020 10   2467 2144.4712    .15040018 202010
                      "Costa Rica"             30 2020 11   2300 2135.4817    .07704034 202011
                      "Costa Rica"             31 2020 12   2897 2342.4712    .23672813 202012
                      "Ecuador"                31 2020  1   6713  6827.022   -.01670164 202001
                      "Ecuador"                29 2020  2   6062  6165.761  -.016828587 202002
                      "Ecuador"                31 2020  3  10054  6493.534     .5483095 202003
                      "Ecuador"                30 2020  4  21042  6127.936    2.4337826 202004
                      "Ecuador"                31 2020  5  10140  6101.534     .6618772 202005
                      "Ecuador"                30 2020  6   9015  5997.936    .50301707 202006
                      "Ecuador"                31 2020  7  10859  6213.534     .7476368 202007
                      "Ecuador"                31 2020  8  10066  6353.534     .5843152 202008
                      "Ecuador"                30 2020  9   8010  6185.436    .29497746 202009
                      "Ecuador"                31 2020 10   7582  5998.534    .26397556 202010
                      "Ecuador"                30 2020 11   7374  6070.936    .21463975 202011
                      "Ecuador"                31 2020 12   7662  6615.034    .15827075 202012
                      "Ecuador"                31 2021  1   9445  6973.711      .354372 202101
                      "Ecuador"                28 2021  2   8793  6085.642     .4448763 202102
                      "Ecuador"                31 2021  3  10241  6640.223     .5422675 202103
                      "Egypt"                  31 2020  1  57039  58231.23     -.020474 202001
                      "Egypt"                  29 2020  2  49779  49510.77   .005417706 202002
                      "Egypt"                  31 2020  3  48353  45942.87    .05245925 202003
                      "Egypt"                  30 2020  4  42228   42286.5 -.0013832963 202004
                      "Egypt"                  31 2020  5  56380  43484.47     .2965548 202005
                      "Egypt"                  30 2020  6  78777   43017.7     .8312697 202006
                      "Egypt"                  31 2020  7  61100  47146.07    .29597226 202007
                      "Egypt"                  31 2020  8  55856  49496.87    .12847537 202008
                      "Egypt"                  30 2020  9  49309  42436.29    .16195346 202009
                      "Egypt"                  31 2020 10  45958  42805.27    .07365282 202010
                      "Egypt"                  30 2020 11  50200   43580.7     .1518862 202011
                      "El Salvador"            31 2020  1   3553  3580.593  -.007706326 202001
                      "El Salvador"            29 2020  2   3166  3210.064   -.01372682 202002
                      "El Salvador"            31 2020  3   2998  3414.312   -.12193141 202003
                      "El Salvador"            30 2020  4   2762  3292.805   -.16120148 202004
                      "El Salvador"            31 2020  5   3284  3491.912   -.05954098 202005
                      "El Salvador"            30 2020  6   6150  3707.405     .6588422 202006
                      "El Salvador"            31 2020  7   8484  3615.112    1.3468153 202007
                      "El Salvador"            31 2020  8   4971  3509.512     .4164363 202008
                      "Georgia"                31 2020  1   4630 4601.0313   .006296187 202001
                      "Georgia"                29 2020  2   4136  4033.834    .02532718 202002
                      "Georgia"                31 2020  3   4001 4158.2373   -.03781344 202003
                      "Georgia"                30 2020  4   3644  3901.726   -.06605445 202004
                      "Georgia"                31 2020  5   3860  3827.437   .008507715 202005
                      "Georgia"                30 2020  6   3523  3490.926  .0091877105 202006
                      "Georgia"                31 2020  7   3706  3410.637    .08660045 202007
                      "Georgia"                31 2020  8   3361  3491.437   -.03735919 202008
                      "Georgia"                30 2020  9   3299  3147.726    .04805806 202009
                      "Georgia"                31 2020 10   4085  3599.637    .13483657 202010
                      "Georgia"                30 2020 11   5929 3832.5264     .5470213 202011
                      "Georgia"                31 2020 12   6363  4230.037    .50424206 202012
                      "Jakarta"                31 2020  1   3303   2951.34    .11915274 202001
                      "Jakarta"                29 2020  2   2744   2865.19   -.04229736 202002
                      "Jakarta"                31 2020  3   4422   3104.51     .4243795 202003
                      "Jakarta"                30 2020  4   4550 3023.6384    .50480956 202004
                      "Jakarta"                31 2020  5   4355   2906.01     .4986185 202005
                      "Jamaica"                31 2020  1   1568 1681.6942   -.06760698 202001
                      "Jamaica"                29 2020  2   1409  1583.563   -.11023436 202002
                      "Jamaica"                31 2020  3   1497  1652.233   -.09395353 202003
                      "Jamaica"                30 2020  4   1457   1500.49  -.028983943 202004
                      "Jamaica"                31 2020  5   1423  1528.033   -.06873747 202005
                      "Jamaica"                30 2020  6   1479   1535.29  -.036664158 202006
                      "Jamaica"                31 2020  7   1513  1624.633   -.06871282 202007
                      "Jamaica"                31 2020  8   1619  1534.833     .0548378 202008
                      "Jamaica"                30 2020  9   1642   1510.69    .08692046 202009
                      "Jamaica"                31 2020 10   1609  1536.833    .04695817 202010
                      "Jamaica"                30 2020 11   1547   1496.89    .03347599 202011
                      "Japan"                  31 2020  1 132622 138467.78   -.04221758 202001
                      "Japan"                  29 2020  2 115554 123139.38   -.06159992 202002
                      "Japan"                  31 2020  3 117979 123190.33   -.04230307 202003
                      "Japan"                  30 2020  4 112407 113311.15  -.007979364 202004
                      "Japan"                  31 2020  5 107484 111122.33   -.03274166 202005
                      "Japan"                  30 2020  6 100423 102966.55   -.02470269 202006
                      "Japan"                  31 2020  7 104849 108300.93  -.031873498 202007
                      "Japan"                  31 2020  8 111591 110505.13   .009826428 202008
                      "Japan"                  30 2020  9 107468 107592.95 -.0011613304 202009
                      "Japan"                  31 2020 10 118038 116330.53   .014677752 202010
                      "Japan"                  30 2020 11 118455 119158.75  -.005905995 202011
                      "Japan"                  31 2020 12 133185 128426.73    .03705047 202012
                      "Japan"                  31 2021  1 140844 140273.81  .0040647816 202101
                      "Kazakhstan"             31 2020  1  11867  12076.58  -.017354226 202001
                      "Kazakhstan"             29 2020  2  10842 10857.884 -.0014628575 202002
                      "Kazakhstan"             31 2020  3   8511 11077.225   -.23166674 202003
                      "Kazakhstan"             30 2020  4   4441  11405.42    -.6106237 202004
                      "Kazakhstan"             31 2020  5  14358 11130.978    .28991368 202005
                      "Kazakhstan"             30 2020  6  14949  10790.03    .38544565 202006
                      "Kazakhstan"             31 2020  7  28178  11929.54     1.362036 202007
                      "Kazakhstan"             31 2020  8  17835  10431.54     .7097189 202008
                      "Kazakhstan"             30 2020  9  13672  10544.28     .2966272 202009
                      "Kazakhstan"             31 2020 10  12489  11235.04     .1116116 202010
                      "Kazakhstan"             30 2020 11  12388  10609.53     .1676295 202011
                      "Kazakhstan"             31 2020 12  13083  10675.79    .22548316 202012
                      "Kazakhstan"             31 2021  1  12478  12113.32   .030105596 202101
                      "Kazakhstan"             28 2021  2  11186  10516.66    .06364571 202102
                      "Kosovo"                 31 2020  1    918  872.7859    .05180436 202001
                      "Kosovo"                 29 2020  2    745  801.7018   -.07072676 202002
                      "Kosovo"                 31 2020  3    831   828.543  .0029653744 202003
                      "Kosovo"                 30 2020  4    481  773.6997    -.3783118 202004
                      "Kosovo"                 31 2020  5    778  784.9431  -.008845303 202005
                      "Kosovo"                 30 2020  6    629  778.4998    -.1920357 202006
                      "Kosovo"                 31 2020  7   1126  700.3431     .6077835 202007
                      "Kosovo"                 31 2020  8   1306   763.543     .7104471 202008
                      "Kosovo"                 30 2020  9   1216  731.0997     .6632478 202009
                      "Kosovo"                 31 2020 10    958  807.9431     .1857271 202010
                      "Kosovo"                 30 2020 11   1094  761.0997    .43739375 202011
                      "Kosovo"                 31 2020 12   1026   767.743     .3363846 202012
                      "Kosovo"                 31 2021  1   1714  881.5002     .9444124 202101
                      "Kyrgyzstan"             31 2020  1   3082  3001.703   .026750606 202001
                      "Kyrgyzstan"             29 2020  2   2900   2684.75     .0801752 202002
                      "Kyrgyzstan"             31 2020  3   2390  2733.243    -.1255809 202003
                      "Kyrgyzstan"             30 2020  4   1263  2661.532    -.5254613 202004
                      "Kyrgyzstan"             31 2020  5   2919  2754.843    .05958845 202005
                      "Kyrgyzstan"             30 2020  6   3559  2591.132     .3735309 202006
                      "Kyrgyzstan"             31 2020  7   4045  2858.443      .415106 202007
                      "Kyrgyzstan"             31 2020  8   4572  2609.243     .7522323 202008
                      "Kyrgyzstan"             30 2020  9   3411  2508.132     .3599762 202009
                      "Kyrgyzstan"             31 2020 10   3423  2741.643    .24852134 202010
                      "Kyrgyzstan"             30 2020 11   4154  2732.532    .52020174 202011
                      "Kyrgyzstan"             31 2020 12   4259  3038.843     .4015202 202012
                      "Kyrgyzstan"             31 2021  1   2988  2980.117    .00264519 202101
                      "Mauritius"              31 2020  1    965  983.4243  -.018734874 202001
                      "Mauritius"              29 2020  2    845  880.5248   -.04034507 202002
                      "Mauritius"              31 2020  3    929  972.3092   -.04454262 202003
                      "Mauritius"              30 2020  4    850  885.5767   -.04017342 202004
                      "Mauritius"              31 2020  5    893  928.7092   -.03845035 202005
                      "Mauritius"              30 2020  6    910  892.9766    .01906361 202006
                      "Mauritius"              31 2020  7   1006 1074.9092   -.06410699 202007
                      "Mauritius"              31 2020  8   1002 1015.9092   -.01369138 202008
                      "Mauritius"              30 2020  9    906  988.5767   -.08353084 202009
                      "Mauritius"              31 2020 10    932  946.7092  -.015537187 202010
                      "Mauritius"              30 2020 11    899  893.9766   .005619115 202011
                      "Mauritius"              31 2020 12    923  952.3092  -.030776976 202012
                      "Moldova"                31 2020  1   3477  3718.195   -.06486891 202001
                      "Moldova"                29 2020  2   3098 3192.8215  -.029698344 202002
                      "Moldova"                31 2020  3   2708 3172.2344   -.14634302 202003
                      "Moldova"                30 2020  4   2275  2889.349    -.2126255 202004
                      "Moldova"                31 2020  5   3873  2984.434    .29773337 202005
                      "Moldova"                30 2020  6   3339  2749.549     .2143808 202006
                      "Moldova"                31 2020  7   3355 2543.0344     .3192901 202007
                      "Moldova"                31 2020  8   2707 2448.0344    .10578514 202008
                      "Moldova"                30 2020  9   3467 2613.1494     .3267516 202009
                      "Moldova"                31 2020 10   3829 2934.2344     .3049401 202010
                      "Moldova"                30 2020 11   3736  3048.349     .2255813 202011
                      "Moldova"                31 2020 12   4754 3024.2344    .57196814 202012
                      "Mongolia"               31 2020  1   1366  1455.567   -.06153423 202001
                      "Mongolia"               29 2020  2   1298 1376.7825    -.0572222 202002
                      "Mongolia"               31 2020  3   1292 1496.6807   -.13675639 202003
                      "Mongolia"               30 2020  4   1310 1401.9813  -.065608054 202004
                      "Mongolia"               31 2020  5   1288 1479.4806   -.12942423 202005
                      "Mongolia"               30 2020  6   1306 1385.3812   -.05729922 202006
                      "Mongolia"               31 2020  7   1402 1435.0807  -.023051415 202007
                      "Mongolia"               31 2020  8   1331 1425.4806   -.06627984 202008
                      "Mongolia"               30 2020  9   1405 1445.5813   -.02807263 202009
                      "Mongolia"               31 2020 10   1427 1455.6807  -.019702563 202010
                      "Mongolia"               30 2020 11   1278 1369.1813  -.066595465 202011
                      "Mongolia"               31 2020 12   1219 1551.8806   -.21450144 202012
                      "Mongolia"               31 2021  1   1151  1475.194    -.2197637 202101
                      "Mongolia"               28 2021  2   1237 1347.0348   -.08168666 202102
                      "Mongolia"               31 2021  3   1381 1516.3075   -.08923488 202103
                      "Nicaragua"              31 2020  1   2108 2112.4727 -.0021173144 202001
                      "Nicaragua"              29 2020  2   1798 1809.8678  -.006557298 202002
                      "Nicaragua"              31 2020  3   2759  1976.591     .3958376 202003
                      "Nicaragua"              30 2020  4   3240 1982.5477     .6342608 202004
                      "Nicaragua"              31 2020  5   3348  1974.091     .6959705 202005
                      "Nicaragua"              30 2020  6   3240 1982.2977     .6344669 202006
                      "Nicaragua"              31 2020  7   3544  2110.841     .6789517 202007
                      "Nicaragua"              31 2020  8   3544  2114.591     .6759742 202008
                      "North Macedonia"        31 2020  1   1774 1979.4075   -.10377222 202001
                      "North Macedonia"        29 2020  2   1653 1759.2596   -.06040021 202002
                      "North Macedonia"        31 2020  3   1674  1760.689   -.04923584 202003
                      "North Macedonia"        30 2020  4   1631  1576.254   .034731798 202004
                      "North Macedonia"        31 2020  5   1602  1594.489   .004710603 202005
                      "North Macedonia"        30 2020  6   1831  1474.454    .24181573 202006
                      "North Macedonia"        31 2020  7   1926  1556.689    .23724136 202007
                      "North Macedonia"        31 2020  8   1747  1522.289     .1476139 202008
                      "North Macedonia"        30 2020  9   1746 1445.6538      .207758 202009
                      "North Macedonia"        31 2020 10   1800  1679.489    .07175457 202010
                      "North Macedonia"        30 2020 11   3205 1606.6538     .9948292 202011
                      "North Macedonia"        31 2020 12   4460  1801.289    1.4760047 202012
                      "North Macedonia"        31 2021  1   2149  1965.304     .0934696 202101
                      "Oman"                   31 2020  1    817   852.549   -.04169723 202001
                      "Oman"                   29 2020  2    696  746.8495   -.06808539 202002
                      "Oman"                   31 2020  3    817  817.2587 -.0003165673 202003
                      "Oman"                   30 2020  4    694  739.4891    -.0615142 202004
                      "Oman"                   31 2020  5    758  745.8587   .016278261 202005
                      "Oman"                   30 2020  6    868  731.8891    .18597206 202006
                      "Oman"                   31 2020  7   1029  778.2587     .3221824 202007
                      "Oman"                   31 2020  8   1007  764.8587      .316583 202008
                      "Oman"                   30 2020  9   1073  737.0891     .4557264 202009
                      "Oman"                   31 2020 10   1070  758.2587     .4111279 202010
                      "Oman"                   30 2020 11    893  748.2891    .19338906 202011
                      "Oman"                   31 2020 12    863  820.6587    .05159426 202012
                      "Oman"                   31 2021  1    835  872.9019    -.0434205 202101
                      "Oman"                   28 2021  2    734  739.4794  -.007409774 202102
                      "Panama"                 31 2020  1   2032 1842.6465    .10276175 202001
                      "Panama"                 29 2020  2   1531  1607.216   -.04742118 202002
                      "Panama"                 31 2020  3   1287 1718.7758    -.2512112 202003
                      "Panama"                 30 2020  4     69 1698.6604    -.9593797 202004
                      "Panama"                 31 2020  5   2483 1697.1757     .4630188 202005
                      "Panama"                 30 2020  6   2284 1739.8604      .312749 202006
                      "Panama"                 31 2020  7   2742 1825.3757     .5021565 202007
                      "Panama"                 31 2020  8   2668 1779.3757     .4994023 202008
                      "Panama"                 30 2020  9   2401 1780.2604     .3486791 202009
                      "Panama"                 31 2020 10   2131 1812.1757    .17593454 202010
                      "Panama"                 30 2020 11   2108 1736.4603     .2139638 202011
                      "Panama"                 31 2020 12   2140 1798.3757     .1899627 202012
                      "Paraguay"               31 2020  1   2712  2704.914  .0026197224 202001
                      "Paraguay"               29 2020  2   2720  2513.755    .08204672 202002
                      "Paraguay"               31 2020  3   2851  2614.097    .09062532 202003
                      "Paraguay"               30 2020  4   2410  2557.223   -.05757128 202004
                      "Paraguay"               31 2020  5   2512 2857.2966   -.12084732 202005
                      "Paraguay"               30 2020  6   2668 3135.8225   -.14918655 202006
                      "Paraguay"               31 2020  7   2795 3181.4966   -.12148266 202007
                      "Paraguay"               31 2020  8   3238 2972.6965     .0892467 202008
                      "Paraguay"               30 2020  9   3235  2723.223     .1879308 202009
                      "Paraguay"               31 2020 10   3205 2661.4966    .20420967 202010
                      "Paraguay"               30 2020 11   2744 2468.8225      .111461 202011
                      "Paraguay"               31 2020 12   3049  2674.897    .13985713 202012
                      "Peru"                   31 2020  1  10422  10126.97    .02913316 202001
                      "Peru"                   29 2020  2   9779   9737.27  .0042856825 202002
                      "Peru"                   31 2020  3  10251  10375.96  -.012043143 202003
                      "Peru"                   30 2020  4  13744  9665.219     .4220061 202004
                      "Peru"                   31 2020  5  26524  10204.96    1.5991285 202005
                      "Peru"                   30 2020  6  27894 10658.552    1.6170535 202006
                      "Peru"                   31 2020  7  29423 11174.293    1.6330974 202007
                      "Peru"                   31 2020  8  28237  11024.96    1.5611886 202008
                      "Peru"                   30 2020  9  17093 10772.552    .58671784 202009
                      "Peru"                   31 2020 10  13301 11132.293     .1948123 202010
                      "Peru"                   30 2020 11  11914 10387.552    .14694975 202011
                      "Peru"                   31 2020 12  13707  10792.96    .26999462 202012
                      "Peru"                   31 2021  1  22485  10835.95    1.0750375 202101
                      "Peru"                   28 2021  2  29138  10041.87    1.9016508 202102
                      "Peru"                   31 2021  3  29703 11084.938    1.6795818 202103
                      "Philippines"            31 2020  1  53466  54734.87  -.023182066 202001
                      "Philippines"            29 2020  2  46216  49005.74   -.05692688 202002
                      "Philippines"            31 2020  3  45748  50904.44   -.10129648 202003
                      "Philippines"            30 2020  4  44510  50155.09    -.1125526 202004
                      "Philippines"            31 2020  5  50124  52095.64   -.03784656 202005
                      "Philippines"            30 2020  6  48403  49003.29  -.012249885 202006
                      "Philippines"            31 2020  7  54300  51852.64    .04719835 202007
                      "Philippines"            31 2020  8  56620  53558.44    .05716296 202008
                      "Philippines"            30 2020  9  53709  52267.48   .027579583 202009
                      "Philippines"            31 2020 10  53605  54309.24  -.012967236 202010
                      "Philippines"            30 2020 11  49992  51571.29   -.03062333 202011
                      "Qatar"                  31 2020  1    192  193.0538  -.005458654 202001
                      "Qatar"                  29 2020  2    198  191.1262    .03596479 202002
                      "Qatar"                  31 2020  3    221 188.26457     .1738799 202003
                      "Qatar"                  30 2020  4    166  185.2044   -.10369314 202004
                      "Qatar"                  31 2020  5    238  197.8646     .2028429 202005
                      "Qatar"                  30 2020  6    303 182.60443     .6593245 202006
                      "Qatar"                  31 2020  7    269 175.06458    .53657585 202007
                      "Qatar"                  31 2020  8    209  177.8646     .1750513 202008
                      "Qatar"                  30 2020  9    216 181.40443     .1907096 202009
                      "Qatar"                  31 2020 10    226 189.06458    .19535877 202010
                      "Qatar"                  30 2020 11    168 197.00443   -.14722729 202011
                      "Qatar"                  31 2020 12    221 205.46457     .0756112 202012
                      "Qatar"                  31 2021  1    212 191.60867    .10642173 202101
                      "Qatar"                  28 2021  2    178 183.23035  -.028545164 202102
                      "Russia"                 31 2020  1 164075 164841.34  -.004648976 202001
                      "Russia"                 29 2020  2 143179 146892.67    -.0252815 202002
                      "Russia"                 31 2020  3 152740    157566   -.03062851 202003
                      "Russia"                 30 2020  4 150873 146581.92   .029274223 202004
                      "Russia"                 31 2020  5 172914 151283.61    .14297906 202005
                      "Russia"                 30 2020  6 162758 143380.92      .135144 202006
                      "Russia"                 31 2020  7 181479 142604.61     .2726026 202007
                      "Russia"                 31 2020  8 157181  142268.4    .10482009 202008
                      "Russia"                 30 2020  9 170717 137050.92    .24564643 202009
                      "Russia"                 31 2020 10 205456  147349.4     .3943456 202010
                      "Russia"                 30 2020 11 219872 139708.53    .57379085 202011
                      "Russia"                 31 2020 12 243235 146378.22     .6616886 202012
                      "Russia"                 31 2021  1 219769 162360.14     .3535896 202101
                      "Russia"                 28 2021  2 172672 139586.33    .23702665 202102
                      "Serbia"                 31 2020  1   8706  9512.457   -.08477904 202001
                      "Serbia"                 29 2020  2   9122  9342.022  -.023551933 202002
                      "Serbia"                 31 2020  3   8189  9109.948    -.1010926 202003
                      "Serbia"                 30 2020  4   8625  8323.131   .036268726 202004
                      "Serbia"                 31 2020  5   8602  8112.749    .06030653 202005
                      "Serbia"                 30 2020  6   8325  7642.131    .08935589 202006
                      "Serbia"                 31 2020  7  10023  7922.948    .26505935 202007
                      "Serbia"                 31 2020  8   8730  7551.148    .15611555 202008
                      "Serbia"                 30 2020  9   8123  7369.331    .10227107 202009
                      "Serbia"                 31 2020 10   8353  8319.148   .004069126 202010
                      "Serbia"                 30 2020 11  10835  8121.531     .3341081 202011
                      "Serbia"                 31 2020 12  17321  9436.548     .8355228 202012
                      "Serbia"                 31 2021  1  10417  9460.973    .10104953 202101
                      "Serbia"                 28 2021  2  10166  8973.383    .13290614 202102
                      "Singapore"              31 2020  1   2085 1932.9728    .07864945 202001
                      "Singapore"              29 2020  2   1758  1752.993   .002856174 202002
                      "Singapore"              31 2020  3   1890 1896.9673 -.0036728715 202003
                      "Singapore"              30 2020  4   1899 1795.4974    .05764564 202004
                      "Singapore"              31 2020  5   1872 1916.3673   -.02315178 202005
                      "Singapore"              30 2020  6   1757 1886.0974   -.06844684 202006
                      "Singapore"              31 2020  7   1752 1941.5673   -.09763623 202007
                      "Singapore"              31 2020  8   1858 1889.5673  -.016706109 202008
                      "Singapore"              30 2020  9   1746 1739.0974   .003969068 202009
                      "Singapore"              31 2020 10   1769 1867.3673     -.052677 202010
                      "Singapore"              30 2020 11   1768 1769.0974 -.0006203184 202011
                      "Singapore"              31 2020 12   1846 1881.1674   -.01869441 202012
                      end
                      
                      
                      gen mdate = ym(year, month)
                      format mdate %tm 
                      
                      myaxis order = region, sort(sd excess) descending 
                      
                      set scheme s1color
                      local min = ym(2020,1)
                      local max = ym(2021,3) 
                      fabplot line excess_deaths_pct_change mdate, by(order) frontopts(lw(thick)) xla(`min'(2)`max', grid format(%tmn)) xtitle("month 2020-21")


                      Click image for larger version

Name:	covid.png
Views:	1
Size:	215.2 KB
ID:	1608199

                      Comment


                      • #12
                        Nick Cox this was an insightful reply. I have to say, fabplot and myaxis are really interesting as I never knew one had the option of sorting on egen functions! I have a followup question and it may seem like a bad one to begin with but I want to understand how one chooses where to use a plot such as the one you have presented us with. I guess this question is a bit too open ended but just to narrow it down, what type of data best suits this plot or is it something that is left on the user? I usually feel that I am going overboard when it can be presented more effectively in a simple manner. Similarly I am not aware of books on visualizations using Stata either. Some more insight will be highly appreciated!

                        Comment


                        • #13
                          Also, just wanted to add the complete code here for the others, I was able to get the desired visual replication

                          Click image for larger version

Name:	Screenshot 2021-05-08 133226.png
Views:	1
Size:	53.0 KB
ID:	1608282


                          Code:
                              local url = "https://raw.githubusercontent.com/TheEconomist/covid-19-excess-deaths-tracker/master/output-data/excess-deaths/"
                              local filemonthly = "all_monthly_excess_deaths.csv"
                              local fileweekly = "all_weekly_excess_deaths.csv"
                              local fileqtrly = "all_quarterly_excess_deaths.csv"
                          
                          
                              insheet using "`url'`filemonthly'", clear
                              generate monthly = 1
                              
                              /* Install user written commands:
                              ssc install heatplot, replace
                              ssc install blindschemes, replace
                              */
                          
                              * Keeping Selected regions from each country
                              egen tag = tag( country region)
                              bysort country: egen count = total(tag)
                              generate ctr_reg = 1 if (country==region) & count>1
                              drop if count>1 & ctr_reg==.
                              drop country tag count ctr_reg
                          
                          
                              * Generate year month indicator
                              encode region, gen(Region)
                              bysort Region: generate yrmth = _n
                              
                              #delimit ;
                              label define yrmth 
                                                  1 "Jan 2020"         2 "Feb" 
                                                  3 "Mar"             4 "Apr" 
                                                  5 "May"             6 "Jun" 
                                                  7 "Jul"             8 "Aug" 
                                                  9 "Sep"             10 "Oct" 
                                                  11 "Nov"             12 "Dec" 
                                                  13 "Jan 2021"         14 "Feb" 
                                                  15 "Mar"             16 "Apr"
                                      , replace ;
                              #delimit cr
                              
                              label values yrmth yrmth
                          
                          
                              
                              * Drawing the Visual
                              replace excess_deaths_pct_change = round(excess_deaths_pct_change*100,1)
                          
                          
                              #delimit ;
                              heatplot excess_deaths_pct_change i.Region i.yrmth, 
                              
                                      ytitle("")                                                             
                                      xtitle("") 
                                      
                                      legend(subtitle("{bf}Deviation from expected deaths, %                  ", 
                                                          span 
                                                          size(1.75)
                                                      ) 
                                              pos(1) 
                                              ring(1) 
                                              rows(1) 
                                              keygap(0.5) 
                                              colgap(0) 
                                              size(1.5) 
                                              symysize(0.85) 
                                              symxsize(7) 
                                              order(1 "" 2 "0" 3 "+25" 4 "+50" 5 "+100" 6 "+200") 
                                              stack
                                          ) 
                                      
                                      ylabel(, 
                                              angle(horizontal) 
                                              labgap(-145) 
                                              labsize(2) 
                                              noticks 
                                              labcolor(gs5) 
                                              nogrid
                                          ) 
                                      
                                      yscale(
                                              noline 
                                              alt 
                                              reverse
                                          ) 
                                          
                                      xscale(extend) 
                                      
                                      xlabel(
                                              0.5 "Jan 2020" 1.5 "Feb" 2.5 "Mar" 3.5 "Apr" 4.5 "May" 
                                              5.5 "Jun" 6.5 "Jul" 7.5 "Aug" 8.5 "Sep" 9.5 "Oct" 
                                              10.5 "Nov" 11.5 "Dec" 12.5 "Jan 2021" 13.5 "Feb" 
                                              14.5 "Mar" 15.5 "Apr", 
                                              labsize(1.75) 
                                              gextend 
                                              labcolor(gs5) 
                                              nogrid
                                          ) 
                                      
                                      graphregion(margin(22=2)) 
                                      plotregion(margin(b=0 t=0)) 
                                      
                                      color("234 242 245" "254 239 216" "253 204 138" "252 140 89" "227 73 51" "179 0 1") 
                                      cuts(@min 0 25 50 100 200 @max) 
                                      
                                      p(
                                          lcolor(white) 
                                          lwidth(0.1) 
                                          lalign(center)
                                      ) 
                                      
                                      addplot(
                                              scatter Region yrmth, 
                                              color(white%0) 
                                              xaxis(2) 
                                              xtitle("", axis(2)) 
                                              xlabel(
                                                      1/16, 
                                                      valuelabels 
                                                      labsize(1.75) 
                                                      labcolor(gs5) 
                                                      nogrid 
                                                      axis(2)
                                                  )
                                          ) 
                                          
                                      title("{bf}Excess deaths by country or city", 
                                              pos(11) 
                                              size(2.25) 
                                              margin(-20 b=-10 t=2)
                                          ) 
                                          
                                      subtitle("Last updated on April 16th", 
                                              pos(11) 
                                              size(2) 
                                              margin(-20 b=-10 t=5)
                                          ) 
                                          
                                      scheme(plotplain);
                              #delimit cr

                          Comment


                          • #14
                            Books on visualization using Stata include

                            https://www.stata.com/bookstore/visu...tata-graphics/

                            https://www.stata.com/bookstore/spea...tata-graphics/

                            and there are examples in many other books, including https://www.stata.com/bookstore/stata-tips/

                            The journal literature -- and what is available through e.g. SSC -- tends to run ahead of the books. So, I hope that Ben Jann will write up heatplot in his own good time and I know that fabplot is written up in a paper to appear in Stata Journal 21(2) and myaxis is written up for Stata Journal 21(3). These papers are due to appear about end June and end September respectively. (As a side-effect of an agreement between British universities and the publisher, these papers will then be immediately accessible even without a subscription to the Journal.)

                            For
                            fabplot see https://www.statalist.org/forums/for...e-on-ssc/page2

                            For myaxis see https://www.statalist.org/forums/for...e-or-graph-use

                            The ability to sort groups on any criterion or criteria you like has been in Stata from the beginning, just more or less fiddly depending on what you want.


                            Your general questions raise vital and intriguing issues. For example, the idea of a heat plot and that of a line plot are both fairly simple to grasp, so it comes down to what works best with data, goals, and audience. My own prejudice runs that heatplots are a little oversold, but sometimes all alternatives yield a complete mess and then heatplots are the best you can do and Ben's implementation is naturally excellent. WItness many examples in modern biology. (I like Mondrian in any case.)

                            Comment


                            • #15
                              I assume you mean Piet Mondriaan (Dutch names are weird, I should know by now...)
                              ---------------------------------
                              Maarten L. Buis
                              University of Konstanz
                              Department of history and sociology
                              box 40
                              78457 Konstanz
                              Germany
                              http://www.maartenbuis.nl
                              ---------------------------------

                              Comment

                              Working...
                              X