clear set mem 30M set more off cd "C:\Users\josh\Documents\My Dropbox\Classes\Econ 174\Section" capture log close log using week14.log.log, replace sysuse auto, clear * basic scatter twoway (scatter mpg price, sort), ytitle(MPG) xtitle(Price) title(MPG vs Price) xline(6000) * spline reg mpg price if price<=6000 predict pred_less if price<=6000 reg mpg price if price>6000 predict pred_great if price>6000 twoway (scatter bin_avg bin, msymbol(oh) sort) (line pred_less price if price<=6000) (line pred_great price if price>6000), xline(6000) legend(off) ytitle(MPG) xtitle(Price) title(MPG vs Price) xline(6000)