* xtivreg (Panel IV linear models) log using xtivreg.log, replace clear set memory 40m set more off * use abdata.dta, clear use http://www.stata-press.com/data/r8/nlswork, clear generate age2 = age^2 tsset idcode year * Some commands require tsset. * FE without endogeneity correction xtreg ln_w age* tenure not_smsa union south, fe i(idcode) * FE with endogeneity correction xtivreg ln_w age* not_smsa (tenure = union south), fe i(idcode) * RE with endogeneity correction generate byte black = (race == 2) xtivreg ln_w age* not_smsa black (tenure = union birth south), re i(idcode) * FD with endogeneity correction xtivreg ln_w age* not_smsa black (tenure = union birth south), fd i(idcode)