* * Example 4.3 from page 51-52 * open data tablef4-1[1].txt data(format=prn,org=columns,skip=36) 1 753 lfp whrs kl6 k618 wa we ww rpwg hhrs ha he hw faminc mtr wmed wfed un cit * * Create the variables needed. Earnings are whrs*ww, and we need the log of that. * We need the square of wa. And we need a dummy for the observations with a * non-zero number of kids. We can construct that by taking kl6+k18 (number of * kids) and using the relational operator >. (kl6+k18)>0 is 1 if the number of * kids is >0 and 0 if the number of kids is equal to zero * set logearn = log(whrs*ww) set agesq = wa**2 set kids = (kl6+k618)>0 * * Run the regression over the sample which has lfp equal to 1 * linreg(smpl=lfp,vcv) logearn # constant wa agesq we kids * * This shows the effect of the age variables. We create an "x" variable which is * just equal to the age for 18-70. (We don't want to use the actual data, because * they aren't sorted by age). Then the age effect variable is created by taking * the second coefficient from the regression (%beta(2)) times the test value for * the age, and the third coefficient times the age squared. The SCATTER * instruction with STYLE=LINE draws the function. * set testage 18 70 = t set ageeffect 18 70 = %beta(2)*testage+%beta(3)*testage**2 scatter(style=line,footer="Age Effect on log(earnings)") # testage ageeffect