Hello Statalist,
I'm about to replicate this Pooled OLS estimation from World Happiness Report (Table 8, page 18): https://happiness-report.s3.amazonaw...l_Appendix.pdf
I believe I used the same data, however my estimation result kind of different from the orginal work and (I think) that's because my estimation missed one year fixed effect. The time fixed effect should be from 2005-2022 but mine was 2006-2022. The data is from 1990-2022 so it actually included 2005 data as well but with many missing data. And I'm struggle to include the 2005 data so it can appear on the estimation. Here's the data example:
Here's the command I used:
and the result:
Please I need any advice on how to include the 2005 year fixed effects and if anything I do was wrong at the beginning. Thank you in advance
I'm about to replicate this Pooled OLS estimation from World Happiness Report (Table 8, page 18): https://happiness-report.s3.amazonaw...l_Appendix.pdf
I believe I used the same data, however my estimation result kind of different from the orginal work and (I think) that's because my estimation missed one year fixed effect. The time fixed effect should be from 2005-2022 but mine was 2006-2022. The data is from 1990-2022 so it actually included 2005 data as well but with many missing data. And I'm struggle to include the 2005 data so it can appear on the estimation. Here's the data example:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int Year long country1 double(happiness_score log_GDP_per_capita life_expectancy social_support freedom generosity perceptions_corruption) 1990 1 . . . . . . . 1991 1 . . . . . . . 1992 1 . . . . . . . 1993 1 . . . . . . . 1994 1 . . . . . . . 1995 1 . . . . . . . 1996 1 . . . . . . . 1997 1 . . . . . . . 1998 1 . . . . . . . 1999 1 . . . . . . . 2000 1 . . . . . . . 2001 1 . . . . . . . 2002 1 . . . . . . . 2003 1 . . . . . . . 2004 1 . . . . . . . 2005 1 . . . . . . . 2006 1 . . . . . . . 2007 1 . . . . . . . 2008 1 3.7235898971557617 7.35041618347168 50.5 .4506623148918152 .7181143164634705 .1676524579524994 .8816863298416138 2009 1 4.401778221130371 7.508646011352539 50.79999923706055 .5523084402084351 .6788963675498962 .19080880284309387 .8500354290008545 2010 1 4.758380889892578 7.6138997077941895 51.099998474121094 .5390751957893372 .6001272201538086 .12131604552268982 .7067660689353943 2011 1 3.831719160079956 7.581258773803711 51.400001525878906 .52110356092453 .4959014058113098 .16357149183750153 .731108546257019 2012 1 3.782937526702881 7.660505771636963 51.70000076293945 .5206367373466492 .5309350490570068 .2375875860452652 .7756198048591614 2013 1 3.5721004009246826 7.680333137512207 52 .48355185985565186 .5779553651809692 .06266622245311737 .8232041001319885 2014 1 3.1308956146240234 7.670638084411621 52.29999923706055 .525568425655365 .5085140466690063 .10575488209724426 .8712419867515564 2015 1 3.9828546047210693 7.653833389282227 52.599998474121094 .5285972356796265 .3889275789260864 .08165227621793747 .8806383013725281 2016 1 4.220168590545654 7.650369644165039 52.92499923706055 .5590717792510986 .5225661993026733 .043916016817092896 .7932455539703369 2017 1 2.6617181301116943 7.647830486297607 53.25 .4908800721168518 .4270108640193939 -.11941047012805939 .9543925523757935 2018 1 2.694303274154663 7.630800724029541 53.57500076293945 .5075158476829529 .37353554368019104 -.09110598266124725 .9276056885719299 2019 1 2.375091791152954 7.640085697174072 53.900001525878906 .41997286677360535 .3936561644077301 -.10601644963026047 .9238491058349609 2020 1 . . . . . . . 2021 1 2.4360344409942627 7.324032306671143 54.54999923706055 .4541746973991394 .394305944442749 -.08101112395524979 .9462993741035461 2022 1 1.2812711000442505 . 54.875 .2282172292470932 .368377149105072 . .7331978678703308 1990 2 . . . . . . . 1991 2 . . . . . . . 1992 2 . . . . . . . 1993 2 . . . . . . . 1994 2 . . . . . . . 1995 2 . . . . . . . 1996 2 . . . . . . . 1997 2 . . . . . . . 1998 2 . . . . . . . 1999 2 . . . . . . . 2000 2 . . . . . . . 2001 2 . . . . . . . 2002 2 . . . . . . . 2003 2 . . . . . . . 2004 2 . . . . . . . 2005 2 . . . . . . . 2006 2 . . . . . . . 2007 2 4.634251594543457 9.1217041015625 66.76000213623047 .8213716149330139 .5286047458648682 -.010428507812321186 .8746995329856873 2008 2 . . . . . . . 2009 2 5.485469818115234 9.241429328918457 67.31999969482422 .8330466151237488 .5252232551574707 -.1592588573694229 .8636654019355774 2010 2 5.268936634063721 9.282793045043945 67.5999984741211 .7331522703170776 .5689584016799927 -.1736752837896347 .7262616753578186 2011 2 5.867421627044678 9.310619354248047 67.87999725341797 .7594338059425354 .4874962568283081 -.20618607103824615 .8770025968551636 2012 2 5.510124206542969 9.326343536376953 68.16000366210938 .7845017910003662 .6015121340751648 -.17046748101711273 .8476752042770386 2013 2 4.550647735595703 9.338146209716797 68.44000244140625 .7594767212867737 .6318302750587463 -.1288250982761383 .862904965877533 2014 2 4.81376314163208 9.357805252075195 68.72000122070313 .6255869269371033 .7346484065055847 -.026297539472579956 .8827044367790222 2015 2 4.6066508293151855 9.382661819458008 69 .6393561363220215 .7038506865501404 -.08249161392450333 .8847930431365967 2016 2 4.511100769042969 9.41687297821045 69.0250015258789 .6384114623069763 .7298189401626587 -.018664082512259483 .901070773601532 2017 2 4.639548301696777 9.455109596252441 69.05000305175781 .6376982927322388 .7496110200881958 -.030505668371915817 .8761346340179443 2018 2 5.0044026374816895 9.496984481811523 69.07499694824219 .6835916638374329 .8242123126983643 .007197479251772165 .8991293907165527 2019 2 4.9953179359436035 9.521909713745117 69.0999984741211 .6863648891448975 .777351438999176 -.1009097695350647 .9142842888832092 2020 2 5.364909648895264 9.492215156555176 69.125 .7101150155067444 .7536710500717163 .004123116377741098 .8913589715957642 2021 2 5.255481719970703 9.583207130432129 69.1500015258789 .7018827795982361 .8274527192115784 .04137755185365677 .8961266279220581 2022 2 5.212213039398193 9.626482963562012 69.17500305175781 .7240896224975586 .8022497892379761 -.06598725914955139 .8455019593238831 1990 3 . . . . . . . 1991 3 . . . . . . . 1992 3 . . . . . . . 1993 3 . . . . . . . 1994 3 . . . . . . . 1995 3 . . . . . . . 1996 3 . . . . . . . 1997 3 . . . . . . . 1998 3 . . . . . . . 1999 3 . . . . . . . 2000 3 . . . . . . . 2001 3 . . . . . . . 2002 3 . . . . . . . 2003 3 . . . . . . . 2004 3 . . . . . . . 2005 3 . . . . . . . 2006 3 . . . . . . . 2007 3 . . . . . . . 2008 3 . . . . . . . 2009 3 . . . . . . . 2010 3 5.463566780090332 9.306354522705078 65.5 . .5926958322525024 -.20975297689437866 .6180378794670105 2011 3 5.31719446182251 9.315958023071289 65.5999984741211 .8102344870567322 .5295612812042236 -.18508440256118774 .637981653213501 2012 3 5.60459566116333 9.329961776733398 65.69999694824219 .8393968939781189 .5866634845733643 -.17657119035720825 .6901163458824158 2013 3 . . . . . . . 2014 3 6.354898452758789 9.355415344238281 65.9000015258789 .8181894421577454 . . . 2015 3 . . . . . . . 2016 3 5.340853691101074 9.383312225341797 66.0999984741211 .7485882639884949 . . . 2017 3 5.248912334442139 9.37665843963623 66.19999694824219 .8067538738250732 .4366704821586609 -.1714705228805542 .6997742056846619 2018 3 5.043086051940918 9.369553565979004 66.30000305175781 .7986513376235962 .5833805799484253 -.15055912733078003 .7587041258811951 2019 3 4.744627475738525 9.361109733581543 66.4000015258789 .8032586574554443 .3850834369659424 .00026843760861083865 .740609347820282 2020 3 5.437755107879639 9.291438102722168 66.5 .8676488995552063 .5738906860351563 -.12114762514829636 .7242636680603027 2021 3 5.217017650604248 9.3092622756958 66.5999984741211 .8407102823257446 .5584869384765625 -.11348341405391693 .7119000554084778 2022 3 . . . . . . . 1990 4 . . . . . . . end label values country1 country1 label def country1 1 "Afghanistan", modify label def country1 2 "Albania", modify label def country1 3 "Algeria", modify label def country1 4 "Angola", modify
Here's the command I used:
Code:
xtset country1 Year
Code:
reg happiness_score log_GDP_per_capita social_support life_expectancy freedom generosity perceptions_corruption i.Year, vce (cluster Country)
Code:
Linear regression Number of obs = 1,903 F(22, 147) = . Prob > F = . R-squared = 0.7629 Root MSE = .56118 (Std. err. adjusted for 148 clusters in Country) ------------------------------------------------------------------------------- | Robust happiness_s~e | Coefficient std. err. t P>|t| [95% conf. interval] --------------+---------------------------------------------------------------- log_GDP_per~a | .3675455 .0686916 5.35 0.000 .2317949 .5032961 social_supp~t | 2.512036 .3649847 6.88 0.000 1.790741 3.233331 life_expect~y | .0279644 .010497 2.66 0.009 .0072198 .048709 freedom | 1.262733 .3080191 4.10 0.000 .6540158 1.871451 generosity | .5726625 .2571264 2.23 0.027 .0645207 1.080804 perceptions~n | -.7058856 .2648248 -2.67 0.009 -1.229241 -.18253 | Year | 2006 | -.4057297 .0850824 -4.77 0.000 -.5738724 -.2375871 2007 | -.160866 .0880224 -1.83 0.070 -.3348189 .0130868 2008 | -.0279241 .08615 -0.32 0.746 -.1981765 .1423283 2009 | -.1571314 .0961686 -1.63 0.104 -.347183 .0329201 2010 | -.238375 .0876574 -2.72 0.007 -.4116065 -.0651435 2011 | -.2236417 .0856636 -2.61 0.010 -.392933 -.0543504 2012 | -.2462114 .0853725 -2.88 0.005 -.4149274 -.0774955 2013 | -.3449375 .0909533 -3.79 0.000 -.5246823 -.1651926 2014 | -.388323 .0838999 -4.63 0.000 -.5541289 -.2225172 2015 | -.3748464 .0815806 -4.59 0.000 -.5360688 -.213624 2016 | -.4021505 .0812837 -4.95 0.000 -.562786 -.241515 2017 | -.3293431 .0799498 -4.12 0.000 -.4873425 -.1713437 2018 | -.3179049 .0802556 -3.96 0.000 -.4765086 -.1593012 2019 | -.3137922 .0798687 -3.93 0.000 -.4716313 -.1559531 2020 | -.3063681 .0772614 -3.97 0.000 -.4590547 -.1536815 2021 | -.3471287 .0742407 -4.68 0.000 -.4938458 -.2004117 2022 | -.3425818 .0729706 -4.69 0.000 -.4867887 -.1983749 | _cons | -1.900342 .5420774 -3.51 0.001 -2.971613 -.8290705 -------------------------------------------------------------------------------
Please I need any advice on how to include the 2005 year fixed effects and if anything I do was wrong at the beginning. Thank you in advance
Comment