Dear All,
I am familiar with the commands of asreg and rolling in Stata to make rolling regressions (many of the forum posts were quite helpful). However, I could not find a lot regarding rolling regressions with the window being a variable instead of a time value. For instance, if I want the window to be a variable (for example, income) between x and y values in an unbalanced panel (instead of time series). Any recommendation? Thank you very much!
With the "desired" regression being
Coeff_diversi (measure of dispersion)= beta_0+ beta_1*gdp_per_capita i. country1 (country fixed effects), robust with a window og 10000 in gdp_per_capita
Thanks!
I am familiar with the commands of asreg and rolling in Stata to make rolling regressions (many of the forum posts were quite helpful). However, I could not find a lot regarding rolling regressions with the window being a variable instead of a time value. For instance, if I want the window to be a variable (for example, income) between x and y values in an unbalanced panel (instead of time series). Any recommendation? Thank you very much!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float country1 int year str2 isic double(Wages OutputINDSTAT4 ValueAdded) float(coeff_diversi gdp_percapita) 218 1963 "16" 305556 4944444 777778 .5130082 4880.8784 578 1963 "17" 36539985 162399935 68599973 .7106571 19577.57 826 1963 "28" 1119999552 4339998264 2015999194 .7767401 15766.834 56 1963 "23" 31799934 840759907 69199850 .5630758 14371.427 710 1963 "15" 114799954 1139599544 324799870 .7362456 8701.798 348 1963 "16" 4599659 34923339 10221465 .6535436 . 188 1963 "26" 801509 3924528 2701887 .4628521 5419.053 554 1963 "28" 33370690 126530533 53949282 .6389886 18497.617 528 1963 "17" 172375819 950276499 262430875 .609821 17149.121 170 1963 "20" 3777778 21222222 9777778 .6257223 4280.184 410 1963 "16" 4615385 103076923 64615385 .758609 1722.5104 392 1963 "21" 283333333 2605555556 913888889 .7718055 8275.577 608 1963 "16" 5625990 64698883 28897130 .6826711 3093.64 710 1963 "23" 13999994 118999952 46199982 .7362456 8701.798 840 1963 "36" 3.040e+09 1.057e+10 5.630e+09 .7825109 20620.72 826 1963 "16" 83999966 839999664 307999877 .7767401 15766.834 792 1963 "16" 12333333 182222222 47777778 .6656876 5975.373 218 1963 "28" 627778 3777778 1333333 .5130082 4880.8784 710 1963 "22" 48999980 132999947 85399966 .7362456 8701.798 170 1963 "24" 20111111 188555556 97333333 .6257223 4280.184 170 1963 "16" 4000000 56222222 39444444 .6257223 4280.184 792 1963 "17" 63111111 466666667 162222222 .6656876 5975.373 788 1963 "20" 628571 3285714 1357143 .48436305 2256.2856 188 1963 "20" 1009811 7849057 4181132 .4628521 5419.053 590 1963 "36" 1345000 5560000 2490000 .5293286 5135.478 288 1963 "20" 7380282 28408451 17042254 .6085891 2951.635 792 1963 "15" 38333333 636666667 165555556 .6656876 5975.373 840 1963 "27" 7.400e+09 3.341e+10 1.439e+10 .7825109 20620.72 250 1963 "27" . 5572547665 1492588853 .5855801 14469.21 470 1963 "17" 268800 2699200 624400 .4270359 2409.7773 792 1963 "27" 13888889 1.400e+08 50000000 .6656876 5975.373 56 1963 "17" 198200357 1204819326 350799698 .5630758 14371.427 470 1963 "22" 579600 1092001 772800 .4270359 2409.7773 788 1963 "28" 976190 6190476 1761905 .48436305 2256.2856 36 1963 "21" 70560011 395360063 169120027 .7586986 19166.545 288 1963 "17" 676056 4112676 1901408 .6085891 2951.635 364 1963 "21" 409241 2724752 1149835 .45206895 13145.432 372 1963 "17" 26878922 140000176 49839242 .4762844 12042.435 124 1963 "33" 66758521 241072439 120536219 .7681732 18873.299 56 1963 "15" 170999977 2914399565 651600525 .5630758 14371.427 348 1963 "20" 20102215 146933560 52385009 .6535436 . 348 1963 "25" 13160136 114991482 40459966 .6535436 . 348 1963 "21" 8901193 80068143 31090290 .6535436 . 392 1963 "27" 794444444 7580555556 2091666667 .7718055 8275.577 752 1963 "24" 106703575 498723230 247428579 .7406743 18558.988 554 1963 "24" 14752626 116797415 38376293 .6389886 18497.617 250 1963 "21" . 1054068956 359728958 .5855801 14469.21 246 1963 "27" 21248567 228124808 43751312 .6219669 12082.25 702 1963 "27" 359334 3593339 1633336 .4753499 6015.885 170 1963 "28" 15444444 90555556 43444444 .6257223 4280.184 410 1963 "33" 423077 3076923 1230769 .758609 1722.5104 800 1963 "15" 5164217 113251995 11621728 .21304467 1027.2823 364 1963 "23" 66007 528053 264026 .45206895 13145.432 608 1963 "20" 12530614 86435662 35546027 .6826711 3093.64 218 1963 "24" 1472223 12333338 6000000 .5130082 4880.8784 124 1963 "15" 787194232 5878458694 1835859340 .7681732 18873.299 528 1963 "23" 27072158 560773709 69889279 .609821 17149.121 608 1963 "28" 9206165 79786765 27362769 .6826711 3093.64 36 1963 "15" 288960046 2279200365 679840109 .7586986 19166.545 826 1963 "23" 117599953 2099999160 307999877 .7767401 15766.834 710 1963 "26" 47599981 194599922 107799957 .7362456 8701.798 410 1963 "26" 8461538 58461538 28461538 .758609 1722.5104 608 1963 "17" 15343609 129909220 46798006 .6826711 3093.64 152 1963 "24" 18495684 160295931 86313194 .4500653 6423.558 288 1963 "16" 422535 20507042 16492958 .6085891 2951.635 792 1963 "24" 14222222 122222222 51111111 .6656876 5975.373 364 1963 "27" 646865 14521452 3234323 .45206895 13145.432 528 1963 "15" 298342834 3646409778 616022315 .609821 17149.121 372 1963 "24" 9519756 70001191 25760897 .4762844 12042.435 800 1963 "16" 455271 2861683 1058799 .21304467 1027.2823 300 1963 "20" 3736895 31337672 9995343 .6587666 9035.88 288 1963 "28" 873239 10070423 2492958 .6085891 2951.635 36 1963 "25" 77280012 328160053 141120023 .7586986 19166.545 410 1963 "21" 3846154 46923077 17692308 .758609 1722.5104 792 1963 "36" 1000000 7222222 3444444 .6656876 5975.373 36 1963 "24" 105280017 744800119 331520053 .7586986 19166.545 800 1963 "20" 680386 2799944 1147977 .21304467 1027.2823 170 1963 "23" 4666667 1.050e+08 28222222 .6257223 4280.184 348 1963 "24" 42546848 507666099 189097104 .6535436 . 410 1963 "25" 5800000 56153846 15576923 .758609 1722.5104 36 1963 "33" 15680003 48160008 26880004 .7586986 19166.545 36 1963 "27" 249760040 1562400250 507360081 .7586986 19166.545 710 1963 "28" 97999961 390599844 172199931 .7362456 8701.798 170 1963 "27" 3222222 82888889 26222222 .6257223 4280.184 218 1963 "22" 1166667 5888889 3222222 .5130082 4880.8784 554 1963 "26" 23053585 100112070 44216164 .6389886 18497.617 300 1963 "15" 30429005 381004305 85664634 .6587666 9035.88 608 1963 "15" 39381929 561064621 247287825 .6826711 3093.64 840 1963 "25" 2.370e+09 9.130e+09 4.650e+09 .7825109 20620.72 246 1963 "17" 48125143 181250128 81250314 .6219669 12082.25 800 1963 "24" 329413 4110178 615988 .21304467 1027.2823 702 1963 "22" 4573340 17313359 9800014 .4753499 6015.885 710 1963 "17" 47599981 289799884 116199954 .7362456 8701.798 826 1963 "26" 671999731 2239999104 1259999496 .7767401 15766.834 376 1963 "26" 17666667 96333333 57666667 .6215691 11281.71 608 1963 "25" 5621131 48090961 22170236 .6826711 3093.64 364 1963 "17" 20039604 184313663 87619010 .45206895 13145.432 124 1963 "26" 202129968 825209501 435784793 .7681732 18873.299 554 1963 "25" 17088574 69522271 33216351 .6389886 18497.617 590 1963 "21" 684000 5550000 1950000 .5293286 5135.478 end
Coeff_diversi (measure of dispersion)= beta_0+ beta_1*gdp_per_capita i. country1 (country fixed effects), robust with a window og 10000 in gdp_per_capita
Thanks!
Comment