Announcement

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

  • Simulating A Monthly Process From a Yearly Dataset

    Say we have some yearly data, and we want to simulate a fictitious outcome at the month level, say this outcome is tax revenue generated by a given sector, where GDP = log GDP per capita, emp = percentage of the population that's employed, dens = population density and pop = the natural log of the population. Say revenue is meant to be measured in millions, we've just scaled it down from there.
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float id int time float(gdppc emp) int dens float pop
     1 2001 11.071144  .6536624 279 15.228995
     1 2002   11.0639  .6373565 284 15.248362
     1 2003 11.074777  .6297612 290 15.266547
     1 2004 11.094922  .6355947 295  15.28562
     1 2005 11.112418  .6456136 302   15.3096
     1 2006 11.092138   .648573 313 15.343542
     1 2007  11.06951  .6509764 321 15.370922
     1 2008 11.011308  .6327124 328 15.391644
     1 2009  10.96412  .6007814 333 15.405972
     1 2010 10.960062  .5905585 337  15.41856
     1 2011   10.9594  .5982675 341  15.43161
     1 2012  10.96362  .5985137 347  15.44722
     1 2013  10.97936  .6074128 351 15.460082
     1 2014 11.008645  .6232224 357 15.475454
     1 2015 11.049763   .634337 363  15.49277
     1 2016 11.083756  .6430805 370  15.51127
     1 2017  11.10181  .6526662 375  15.52594
     1 2018 11.121437  .6650662 380   15.5387
     1 2019 11.155722  .6708129 385   15.5513
     2 2001   10.9117  .6530195 103 14.100759
     2 2002 10.915652  .6349667 105  14.12062
     2 2003 10.907148  .6273877 107 14.141302
     2 2004 10.918048  .6277823 109  14.16574
     2 2005 10.953172  .6426778 113  14.19594
     2 2006 11.010118  .6471314 118 14.237617
     2 2007 10.996534  .6598589 122  14.27779
     2 2008 10.980093  .6555361 127   14.3126
     2 2009   10.9308  .6345878 130 14.341807
     2 2010 10.952262  .6259186 134 14.368255
     2 2011 10.953137  .6265012 138 14.398423
     2 2012 10.952402  .6288261 142  14.42825
     2 2013 10.976218  .6425975 146 14.454407
     2 2014  10.99447  .6502224 151   14.4853
     2 2015 11.044968  .6610805 155 14.515556
     2 2016 11.065325  .6698007 160 14.545037
     2 2017 11.080125  .6808926 164 14.570445
     2 2018 11.108455  .6962863 168 14.594131
     2 2019 11.132675   .698347 173  14.62202
     3 2001 11.178948  .6926392 605 15.210472
     3 2002 11.173445  .6789008 606 15.211262
     3 2003 11.186974  .6721069 605 15.209273
     3 2004 11.216108  .6791054 603 15.206277
     3 2005   11.2382  .6895732 601 15.203847
     3 2006 11.260508  .6968985 602 15.205143
     3 2007 11.288168  .7124439 605 15.209765
     3 2008 11.287955  .7111987 610 15.218093
     3 2009 11.272267   .688778 617 15.228715
     3 2010  11.30713   .683308 622 15.238124
     3 2011  11.31087  .6872678 629  15.24818
     3 2012   11.3248  .6930817 635  15.25877
     3 2013 11.321208   .702827 642 15.269366
     3 2014 11.329663  .7128333 648 15.278884
     3 2015 11.374352  .7397783 653 15.285847
     3 2016 11.392418  .7488503 657 15.292288
     3 2017 11.405418  .7552623 661  15.29898
     3 2018 11.442288  .7659695 664 15.302526
     3 2019  11.47624  .7688969 666 15.305243
     4 2001 11.039653  .6836795 199 14.114742
     4 2002 11.043593  .6704656 204 14.137417
     4 2003 11.067357  .6574553 208  14.15928
     4 2004  11.10196  .6579617 213 14.183146
     4 2005 11.144178  .6623406 220 14.215612
     4 2006 11.177537  .6652502 230 14.257595
     4 2007  11.15296   .669583 239 14.298982
     4 2008 11.185518  .6516839 247 14.331623
     4 2009  11.07186  .6129974 253   14.3536
     4 2010 11.017957  .6018195 256 14.367641
     4 2011 11.048474  .6178097 261 14.384874
     4 2012 11.096273  .6204896 266  14.40438
     4 2013 11.071704  .6253901 271 14.424562
     4 2014 11.088033  .6385227 277 14.444462
     4 2015 11.121762  .6495289 283  14.46594
     4 2016 11.136601   .657124 289 14.489047
     4 2017 11.170478  .6653858 296 14.510884
     4 2018 11.169237  .6725257 301 14.528785
     4 2019  11.18051  .6770978 306 14.545858
     5 2001 10.957817 .59438646 484 16.031403
     5 2002 10.962146  .5851555 486  16.03537
     5 2003 10.974814  .5834346 488 16.038328
     5 2004  10.99933 .58810276 489 16.041288
     5 2005 11.019023 .59595525 490 16.042974
     5 2006  11.04436  .6052647 491 16.045282
     5 2007 11.056967   .614094 493 16.049511
     5 2008 11.027719  .6089853 496 16.054575
     5 2009 10.996266 .58489084 498 16.059353
     5 2010 11.004198  .5776375 500  16.06371
     5 2011 11.016545  .5875038 502 16.066898
     5 2012 11.046021  .5922486 503  16.06976
     5 2013 11.047312  .6000308 504 16.072075
     5 2014 11.072217  .6099952 505 16.073128
     5 2015 11.107645  .6243206 504 16.072298
     5 2016 11.115533  .6339527 504 16.070347
     5 2017 11.128953  .6386741 502  16.06827
     5 2018 11.159075  .6468457 501 16.065264
     5 2019   11.1727  .6489706 499 16.061977
     6 2001 10.866146  .6176143 211  14.48951
     6 2002 10.885903  .6112323 212 14.493373
     6 2003 10.896702  .6112711 213  14.49883
     6 2004  10.91046  .6152213 214 14.504382
     6 2005 10.930694  .6200311 216 14.510326
     6 2006  10.93132  .6204458 217 14.517714
     6 2007 10.932768  .6236373 219 14.524573
     6 2008 10.918954  .6181853 220 14.529902
     6 2009 10.890348  .5947808 221 14.536002
     6 2010 10.916324  .5870506 222 14.540883
     6 2011  10.94288 .59239036 223 14.543887
     6 2012 10.952962 .59591544 224   14.5473
     6 2013  10.95813  .5997993 225 14.552085
     6 2014  10.98217  .6068912 226 14.557144
     6 2015 11.016266  .6157818 227  14.56182
     6 2016  11.05455  .6227275 228 14.566964
     6 2017  11.06092  .6300287 230 14.572408
     6 2018 11.074188  .6388566 231  14.57674
     6 2019  11.11019  .6397438 232 14.581858
     7 2001 10.877047  .6763157 145 14.329773
     7 2002 10.882208  .6649363 147 14.341258
     7 2003 10.886783  .6568735 149 14.354526
     7 2004 10.909253  .6574947 151 14.366204
     7 2005  10.92531  .6581829 153 14.378476
     7 2006  10.91119  .6568102 155    14.393
     7 2007 10.912303  .6620352 157   14.4066
     7 2008 10.883016   .652229 159 14.419552
     7 2009  10.85387  .6289297 161 14.431535
     7 2010 10.870852  .6219884 163 14.441648
     7 2011 10.890778  .6298979 164  14.45226
     7 2012  10.92183  .6374047 166  14.46346
     7 2013  10.93765  .6432046 168 14.477502
     7 2014  10.95473  .6486959 171 14.491754
     7 2015 10.972482  .6547992 173  14.50492
     7 2016 10.988305  .6609511 175 14.517366
     7 2017 10.994034  .6636685 178  14.53242
     7 2018 11.000332  .6689194 180 14.542884
     7 2019  11.01935  .6685414 182 14.552378
     8 2001 10.848813  .6173354 410  14.57715
     8 2002 10.865172  .6057993 408  14.57454
     8 2003 10.884217  .6061254 407 14.572172
     8 2004  10.90927  .6106167 406  14.56831
     8 2005  10.93781  .6153481 404 14.563004
     8 2006 10.945653  .6236895 401  14.55717
     8 2007 10.951385  .6293118 400 14.553438
     8 2008  10.94127  .6245632 399 14.550332
     8 2009 10.885154  .6011721 398  14.54839
     8 2010 10.897868   .598906 397   14.5457
     8 2011 10.917957  .6089628 396  14.54263
     8 2012 10.932375  .6187423 395  14.54065
     8 2013 10.935497  .6242691 395 14.541832
     8 2014 10.955986  .6286055 395 14.541992
     8 2015 10.974094   .636234 395 14.540432
     8 2016 10.982594   .642296 394 14.538876
     8 2017 10.991595  .6461667 393 14.537075
     8 2018  11.01707  .6566755 393 14.535222
     8 2019 11.041048  .6594341 392 14.532876
     9 2001 10.913852  .6423197 157 15.525767
     9 2002 10.917467  .6230708 160 15.545257
     9 2003 10.913487  .6144255 163  15.56186
     9 2004 10.946887  .6164242 166 15.577828
     9 2005 10.975687  .6261632 169 15.596813
     9 2006 11.019432  .6331159 174 15.624687
     9 2007  11.02775  .6433679 178 15.647232
     9 2008 11.022392  .6433308 181 15.667834
     9 2009 10.944754  .6176474 185 15.688144
     9 2010 10.954327  .6095523 188 15.704977
     9 2011  10.97152  .6198703 192 15.722742
     9 2012  10.98307  .6258986 195  15.74246
     9 2013 10.998493  .6346768 199 15.758336
     9 2014  11.01347  .6430641 202 15.777882
     9 2015 11.028466  .6527739 207 15.799457
     9 2016 11.036888  .6607202 211 15.820744
     9 2017 11.049397  .6659867 215  15.84029
     9 2018 11.071253  .6756164 219 15.856662
     9 2019  11.09165  .6782535 222 15.872216
    10 2001  10.91937  .7130504 102 13.902027
    10 2002  10.94724  .7018912 103 13.912266
    10 2003 10.978285  .6988315 104  13.92463
    10 2004 11.006025  .7065807 106 13.941236
    10 2005 11.017103  .7136361 108  13.96018
    10 2006  11.02767  .7180168 111 13.983786
    10 2007  11.01541  .7195126 113 14.005162
    10 2008 11.026272  .7016574 115 14.024068
    10 2009  11.01863   .666888 117  14.03981
    10 2010 11.016726  .6625614 118 14.052603
    10 2011 11.037708  .6711496 120  14.06642
    10 2012 11.079755  .6799818 122 14.084383
    10 2013  11.08034  .6882603 124 14.102018
    10 2014 11.104822  .7064235 127  14.11988
    10 2015 11.169012  .7241265 129 14.137772
    10 2016  11.18499  .7437804 131  14.15446
    10 2017  11.19705  .7590182 133 14.168616
    10 2018 11.205163  .7742161 135  14.18207
    10 2019 11.233662  .7820924 136 14.193324
    11 2001  11.04857  .6775841 103 14.622602
    11 2002 11.041288  .6713595 104  14.63387
    11 2003 11.035276  .6612906 105 14.641822
    11 2004 11.029066  .6652513 106 14.650513
    11 2005 11.055277  .6735002 107 14.662558
    11 2006 11.054613  .6768731 109 14.680168
    11 2007 11.078753  .6882105 111 14.698735
    11 2008 11.057203  .6832857 113 14.717285
    11 2009 11.013452  .6549972 115  14.73556
    11 2010  11.01421  .6409988 117 14.753402
    11 2011 11.008297  .6426486 119 14.772276
    11 2012  11.02084  .6471426 122 14.790408
    11 2013 11.041865  .6576148 124   14.8093
    11 2014 11.061814  .6692775 126 14.828983
    11 2015  11.09127  .6811674 129 14.850254
    11 2016  11.09856  .6933163 131 14.865804
    11 2017 11.114193  .7016755 133 14.878033
    11 2018  11.14057  .7119085 135 14.891874
    11 2019 11.176543  .7129753 136 14.902324
    12 2001  10.89909   .567092 444 15.324101
    12 2002 10.917521  .5596505 444 15.322906
    12 2003  10.93014  .5567838 443 15.322371
    12 2004 10.926621  .5577174 443 15.320893
    12 2005 10.937063  .5632984 441 15.317738
    12 2006 10.904046 .55957735 439 15.313227
    12 2007 10.899384  .5626088 436 15.306032
    12 2008 10.827012 .55414486 433  15.29766
    12 2009 10.745507 .52106506 430 15.291474
    12 2010  10.80135  .5236508 428 15.286838
    12 2011  10.82713 .54002464 428  15.28684
    12 2012 10.863412 .54893094 429 15.288798
    12 2013 10.882378  .5584851 429 15.289742
    12 2014 10.895127    .56783 430 15.291007
    12 2015 10.932732 .57954586 429  15.29055
    12 2016  10.95142  .5874428 430 15.292118
    12 2017 10.949595 .59448856 431 15.293426
    12 2018  10.95895    .60476 431  15.29395
    12 2019 10.959906  .6070771 431  15.29302
    13 2001 11.111716  .6608523 288 13.962647
    13 2002 11.059724  .6481677 290  13.97166
    13 2003 11.082266  .6378276 293 13.980512
    13 2004 11.152243  .6456408 294  13.98323
    13 2005 11.159872  .6526156 295 13.987722
    13 2006 11.198872   .659218 296  13.99259
    13 2007  11.24814  .6691725 298 13.996493
    13 2008  11.22889  .6703677 299 14.001522
    13 2009 11.226789  .6491298 300 14.005804
    13 2010 11.220714  .6380346 302 14.009497
    13 2011 11.206332   .646418 302 14.011213
    13 2012 11.210143  .6511485 302 14.010647
    13 2013 11.179073  .6572304 302 14.010303
    13 2014 11.198955  .6645303 302  14.00963
    13 2015  11.26986  .6713197 301 14.007936
    13 2016 11.278935  .6751515 300 14.005228
    13 2017  11.29335   .677787 300 14.003926
    13 2018 11.291755  .6828545 300 14.003428
    13 2019 11.298135  .6820582 299 14.001784
    14 2001 10.951473  .5933757 167 15.405518
    14 2002 10.909966  .5837906 171 15.429887
    14 2003 10.914543 .57632977 174 15.449793
    14 2004 10.988745 .57574004 177 15.468606
    14 2005  11.01421 .58451205 181 15.487868
    14 2006 11.067466  .5881926 187  15.52296
    14 2007 11.125895   .597662 191 15.544148
    14 2008  11.08736  .6051629 196 15.567988
    14 2009  11.02541 .58569676 201 15.593596
    14 2010  11.06795   .574553 205  15.61391
    14 2011 11.109308  .5825845 209  15.63183
    14 2012 11.130405    .59137 213 15.652294
    14 2013 11.145623   .598917 218 15.675024
    14 2014  11.12822  .6046822 224  15.70151
    14 2015  11.13529  .6039352 230 15.727383
    14 2016 11.087069   .591058 234 15.747438
    14 2017   11.0975  .6005583 238 15.761047
    14 2018   11.1296  .6128321 240 15.772067
    14 2019 11.106205  .6173445 243 15.784717
    15 2001 10.956737   .651798 160 14.329536
    15 2002   10.9552  .6400316 162 14.341823
    15 2003 10.975602  .6360832 164 14.354295
    15 2004  11.01073   .639019 166  14.36666
    15 2005 11.005527  .6416916 168 14.379503
    15 2006  11.01648  .6425581 171  14.39515
    15 2007 11.036195  .6463463 174 14.409523
    15 2008  11.04935  .6398785 176  14.42258
    15 2009  11.04007  .6110885 178  14.43512
    15 2010  11.05482  .6050106 180 14.445427
    15 2011 11.049747  .6117055 182  14.45516
    15 2012 11.042314  .6187679 184 14.465206
    15 2013 11.060007  .6232792 186 14.477704
    15 2014  11.07318  .6302963 188 14.486757
    15 2015  11.05643   .640741 189 14.494516
    15 2016  11.07273  .6490074 191  14.50506
    15 2017 11.069478  .6570418 193 14.515608
    15 2018 11.094527  .6620839 195 14.527593
    15 2019 11.113015  .6629485 197 14.537376
    16 2001 10.896906  .6681166  92 14.385184
    16 2002 10.914106  .6561387  93 14.396753
    16 2003 10.917776  .6494102  94 14.405827
    16 2004 10.925326  .6523337  95 14.415098
    16 2005 10.940987  .6564769  96 14.424253
    16 2006 10.959245  .6600596  97  14.43597
    16 2007 10.974077  .6691002  98 14.447715
    16 2008 10.982764  .6636028  99 14.457404
    16 2009 10.953452  .6383662 100 14.468033
    16 2010  10.93232   .623239 101 14.477135
    16 2011  10.92302  .6284984 101 14.483178
    16 2012  10.95827  .6318411 102 14.489766
    16 2013  10.96232  .6370353 103 14.497497
    16 2014 10.981812  .6448941 104 14.505124
    16 2015 11.016282  .6538643 105 14.513288
    16 2016  11.00659  .6595864 106 14.523343
    16 2017  11.01684  .6618694 107 14.533148
    16 2018 11.027427    .66596 108 14.541796
    16 2019 11.049063  .6639317 108 14.548285
    17 2001 10.744645  .5827223  91  14.02197
    17 2002  10.76253  .5744283  93 14.041752
    17 2003  10.79407 .58051753  95 14.059183
    17 2004 10.816854 .58341354  97 14.084043
    17 2005 10.838973  .5903804  99   14.1048
    17 2006 10.851374  .5976217 101 14.130316
    17 2007 10.854122  .5960128 103 14.149563
    17 2008 10.802794  .5806284 105 14.161938
    17 2009  10.75509 .55113834 106 14.170833
    17 2010 10.739067  .5421389 107  14.18087
    17 2011  10.71484  .5476372 108 14.190125
    17 2012 10.715484 .54797864 109 14.200658
    17 2013 10.734046  .5532611 110   14.2112
    17 2014  10.74389 .55983114 112 14.226845
    17 2015  10.77706  .5677837 114   14.2461
    17 2016  10.79747 .57608396 116  14.26653
    17 2017  10.81378  .5930913 119  14.28554
    17 2018  10.82745  .5996766 121 14.303528
    17 2019 10.855937  .6000338 123 14.321252
    18 2001 10.728255  .6138148  90 14.021383
    18 2002 10.727926  .6023337  90 14.028916
    18 2003  10.74279 .59601676  91 14.038813
    18 2004  10.76397  .5972478  92 14.048068
    18 2005  10.78029  .6014993  93 14.057292
    18 2006  10.79647  .6057811  94 14.069074
    18 2007 10.786903  .6098382  95 14.081407
    18 2008 10.753938  .6003155  96 14.092546
    18 2009 10.717746 .57640725  97 14.100678
    18 2010 10.749528 .56876534  98 14.108738
    18 2011  10.75105  .5730483  98 14.115116
    18 2012 10.790988 .58060396  99 14.121098
    18 2013 10.790576  .5862405 100 14.130005
    18 2014 10.799127  .5964376 100 14.135214
    18 2015 10.832004  .6073211 101   14.1395
    18 2016 10.844705  .6173358 101 14.144402
    18 2017 10.839267   .622568 102 14.149846
    18 2018 10.847043  .6299384 102 14.152256
    18 2019 10.867196  .6289008 102 14.155177
    19 2001 10.814786  .5985706  16 14.219893
    19 2002 10.822694  .5838762  16 14.261278
    19 2003  10.83441  .5897909  17 14.300438
    19 2004 10.899237  .6039563  18  14.34876
    19 2005 10.958635  .6232541  19 14.388838
    19 2006  10.97073  .6294318  19 14.431254
    19 2007 10.958426  .6228091  20 14.466249
    19 2008  10.90228  .6010051  21 14.489385
    19 2009 10.798268  .5527613  21 14.503192
    19 2010 10.778707 .53652316  21 14.509577
    19 2011 10.777977  .5438816  21 14.514347
    19 2012 10.758434  .5446163  21 14.527782
    19 2013 10.761704 .55324733  22  14.54111
    19 2014 10.765808  .5643378  22 14.558403
    19 2015 10.805882 .57480586  22 14.579104
    19 2016 10.820078  .5853611  23 14.598808
    19 2017 10.824885  .5918872  23  14.61863
    19 2018 10.857017  .6028546  24 14.639477
    19 2019 10.884948  .6046132  24  14.66048
    20 2001 10.804238 .54442006 189  16.58113
    20 2002 10.815147 .54005945 192 16.594398
    20 2003  10.84283 .53869736 194 16.607552
    20 2004  10.86851  .5448855 197   16.6183
    20 2005 10.892248  .5526153 198 16.625042
    20 2006 10.925705    .56252 199 16.628325
    20 2007 10.933536   .570489 199 16.630878
    20 2008 10.926855  .5576118 200 16.637259
    20 2009 10.879386 .52964294 202 16.644909
    20 2010 10.895164 .52009135 204 16.653442
    20 2011  10.89574 .52716935 205 16.661486
    20 2012  10.90469 .54268545 207 16.668755
    20 2013  10.92004  .5563685 208 16.675459
    20 2014  10.93781  .5708684 210 16.681906
    20 2015  10.98028 .58510625 211  16.68824
    20 2016  10.99717 .59416854 212 16.692919
    20 2017 11.025148  .6006231 213 16.696362
    20 2018 11.050921  .6149045 213 16.697289
    20 2019 11.084463  .6204243 213 16.696129
    21 2001 10.847198  .6153092 109 13.989093
    21 2002 10.853407  .6075683 110 13.997437
    21 2003 10.859153  .6044662 111  14.00707
    21 2004 10.868473   .606416 112 14.016104
    21 2005  10.88093   .609996 113 14.026235
    21 2006 10.886464  .6155198 115 14.041588
    21 2007 10.864943  .6229245 115  14.04949
    21 2008 10.838678  .6170794 116 14.055862
    21 2009 10.809162  .5930412 117  14.06108
    21 2010 10.805517   .588084 118 14.067427
    21 2011 10.807665  .5965412 118 14.072745
    21 2012 10.841677  .5968778 119 14.078974
    21 2013   10.8553  .5998145 119 14.079632
    21 2014 10.851567  .6097817 119 14.080647
    21 2015 10.886558  .6196479 119   14.0817
    21 2016 10.895145  .6301076 119  14.08321
    21 2017 10.896147  .6351915 120  14.08505
    21 2018 10.893456  .6438416 120 14.088484
    21 2019 10.900344  .6472274 120 14.090652
    22 2001 10.736115  .5586738 327 15.471953
    22 2002 10.761958  .5548566 332  15.48889
    22 2003  10.78744 .55971694 337 15.501596
    22 2004 10.828321   .567878 341 15.515903
    22 2005 10.868435  .5826883 346  15.52986
    22 2006 10.893753  .5958755 347 15.533184
    22 2007 10.903384   .607067 347 15.532282
    22 2008 10.849298 .59335005 349   15.5381
    22 2009 10.785104 .56518644 352  15.54719
    22 2010 10.795609  .5595525 357  15.56129
    22 2011 10.774885 .56972045 363  15.57619
    22 2012  10.76857 .57669765 368 15.589636
    22 2013  10.78359 .58911043 373 15.602997
    22 2014 10.806207  .6077057 377 15.615171
    22 2015 10.849648  .6277437 382  15.62796
    22 2016 10.869444   .633006 387 15.642245
    22 2017  10.89431   .645101 391 15.652143
    22 2018  10.92266  .6683427 393  15.65626
    22 2019  10.94546  .6727178 394 15.660194
    23 2001  10.91821  .6682802 390 14.225802
    23 2002  10.91013  .6562162 392 14.230432
    23 2003 10.927233  .6523294 393 14.234054
    23 2004  10.94111  .6571219 394 14.235734
    23 2005 10.971623  .6622235 394 14.235793
    23 2006 10.992167  .6689923 394 14.236788
    23 2007 10.993513  .6744713 396   14.2411
    23 2008  10.96528  .6706823 398 14.246144
    23 2009 10.945283  .6390473 401 14.253516
    23 2010  10.95785  .6303135 403 14.258084
    23 2011 10.968043  .6368197 404 14.261108
    23 2012 10.974318  .6383038 405 14.264957
    23 2013  10.97459   .645393 407  14.26786
    23 2014  10.97502  .6509179 407 14.270013
    23 2015 10.998995  .6578661 408 14.270967
    23 2016 11.007668   .662405 408 14.270732
    23 2017 11.003765  .6672701 407 14.270047
    23 2018  11.02259  .6753924 407 14.270103
    23 2019 11.041128  .6742132 408 14.271323
    end
    format %ty time
    label values id metro2
    label def metro2 1 "Atlanta", modify
    label def metro2 2 "Austin", modify
    label def metro2 3 "Boston", modify
    label def metro2 4 "Charlotte", modify
    label def metro2 5 "Chicago", modify
    label def metro2 6 "Cincinnati", modify
    label def metro2 7 "Columbus", modify
    label def metro2 8 "Cuyahoga", modify
    label def metro2 9 "Dallas", modify
    label def metro2 10 "Davidson", modify
    label def metro2 11 "Denver", modify
    label def metro2 12 "Detroit", modify
    label def metro2 13 "Hartford", modify
    label def metro2 14 "Houston", modify
    label def metro2 15 "Indianapolis", modify
    label def metro2 16 "Jackson", modify
    label def metro2 17 "Jacksonville", modify
    label def metro2 18 "Jefferson", modify
    label def metro2 19 "Las Vegas", modify
    label def metro2 20 "Los Angeles", modify
    label def metro2 21 "Memphis", modify
    label def metro2 22 "Miami", modify
    label def metro2 23 "Milwaukee", modify
    Here we have half my dataset, which should be quite enough for these purposes. Currently, I generate the outcome (revenue) as
    Code:
    bys id: g revenue = gdp+ sqrt(pop) + ///
    (20*sqrt(emp))-(dens/100) +((time-1990)/_pi) + runiform(0,1)
    But, suppose I wanted to simulate a more complicated process at the monthly level. How might I do this? Would I expand each city-year by 12 for twelve months, and come up with a similar data-generating process at the monthly level?

  • #2
    Here's how I might approach this:

    Code:
    bys id: g revenue = gdp+ sqrt(pop) + ///
    (20*sqrt(emp))-(dens/100) +((time-1990)/_pi)
    expand 12
    by id time, sort: gen mdate = ym(time, _n)
    format mdate %tm
    isid id mdate, sort
    by id (mdate): ipolate revenue mdate, gen(revenue2)
    replace revenue2 = revenue2 + runiform(0, 1)
    (I don't know if runiform(0, 1) is a suitable error distribution for your purposes, as there aren't many processes with this, but, whatever.)

    Added: The issue is what happens to the variables gdp, pop, emp, and dens over the course of each year. The above code basically acts as if those interpolate linearly. I have no idea whether that makes econometric sense or not. If not, you need to develop some models for imputing values to those variables on the non-January months of each year. Another simple model, which probably also makes no sense, is to just carry the January value forward, in effect assuming that these variables get a yearly shock on 1 January and then hold for the rest of the year. Reality, I imagine is more complicated than either of these situations and perhaps you have better ideas how to deal with this.
    Last edited by Clyde Schechter; 03 Aug 2022, 12:55.

    Comment


    • #3
      Correction to above:
      Code:
      bys id: g revenue = gdp+ sqrt(pop) + ///
      (20*sqrt(emp))-(dens/100) +((time-1990)/_pi)
      expand 12
      by id time, sort: gen mdate = ym(time, _n)
      format mdate %tm
      by id time (mdate), sort: replace revenue = . if _n > 1
      by id (mdate), sort: ipolate revenue mdate, gen(revenue2)
      replace revenue2 = revenue2 + runiform(0, 1)

      Comment

      Working...
      X