* use wapop data for descrips and regression *******open log file to save all my output log using "D:\My Documents\529 adv reg course\wapop1.log" *begins log set more off *turns off pause mode *************opens the wapop data. use "D:\My Documents\529 adv reg course\wapop08", clear ***makes set of indicators for region that I can use by prefacing commands with xi: xi i.REGION xi: summarize HHINC i.REGION *********runs regression of household income on region and number of people xi: regress HHINC i.REGION PEOPL *******get predicted income and summarize predict inchat summarize inchat ****what would happen to income if every household had one more person? replace PEOPL =PEOPL+1 summarize inhat2 replace PEOPL = PEOPL=1 **recode into new home ownership dummy recode Q3P2 1=1 2/3=0, generate(owndum) summarize owndum ****create new income squared*********************** generate hhincsq=HHINC*HHINC summarize HHINC hhincsq ***logit of home ownership ************ logit owndum PEOPL HHINC hhincsq _IREGION_2 _IREGION_3 _IREGION_4 _IREGION_5 _IREGION_6 _IREGION_7 _IREGION_8 _IREGION_9 _IREGION_10 *****get predicted probability of home ownership, summarize, and scatterplot predict predprob1, p summarize predprob1 scatter predprob1 HHINC if HHINC< 100000 *****add $10,000 to income if it was less than 10,000 ***and remake income squared to match replace HHINC=HHINC+10000 if HHINC<10000 replace hhincsq=HHINC*HHINC ***get predicted probb with new HHINC predict predprob2, p summarize predprob2 scatter predprob2 HHINC if HHINC< 100000 **calculate marginal effects at median values. mfx compute, dydx at(median) mfx compute, dydx at(mean) *Don't save your data if you changed the values!