version 12.1 set more off use https://www.nd.edu/~rwilliam/statafiles/nlsy.dta, clear des anti* self* pov* gen id=_n reshape long anti pov self, i(id) j(year) xtset id year egen antix = mean(anti), by(id) egen selfx = mean(self), by(id) egen povx = mean(pov), by(id) gen antidif = anti - antix gen selfdif = self - selfx gen povdif = pov - povx reg antidif selfdif povdif i.year xtreg anti self pov i.year, fe xtreg anti self pov i.year black hispanic childage married gender momage momwork, fe xtreg anti self pov i.year, re xtreg anti self pov i.year black hispanic childage married gender momage momwork, re * Appendix A - Setting up the data use https://www.nd.edu/~rwilliam/statafiles/teenpov.dta, clear rename inschool* school* list in 1/3 reshape long pov mother spouse school hours, i(id) j(year) list in 1/15 xtset id year xtset xtsum * Appendix B - UML use https://www.nd.edu/~rwilliam/statafiles/nlsy.dta, clear set matsize 2000 reg anti self pov i.year i.id reg anti self pov i.year i.id black hispanic childage married gender momage momwork * Appendix C - Hausman use https://www.nd.edu/~rwilliam/statafiles/nlsyxt.dta, clear quietly tab1 year, gen(yr) quietly xtreg anti self pov yr2 yr3, fe estimates store fixed quietly xtreg anti self pov yr2 yr3 black hispanic childage married gender momage momwork, re estimates store random hausman fixed random