sysuse auto reg price mpg i.foreign predict r1 separate r1, by(foreign) twoway (scatter price mpg)(line r10 mpg) (line r11 mpg), name(model1) estimates store model1 reg price mpg foreign#c.mpg estimates store model2 predict r2 separate r2, by(foreign) twoway (scatter price mpg)(line r20 mpg) (line r21 mpg), name(model2) estimates table model1 model2, se p regress price c.mpg##foreign predict r3 estimates store model3 generate diff = r3 - r2 scatter diff mpg, name(diff) separate diff, by(foreign) line diff0 diff1 mpg estimates table model1 model2 model3, se p stats(r2) summarize mpg, meanonly generate cmpg = mpg - r(mean) regress price c.cmpg##foreign predict r4 estimates store model4 regress price c.cmpg##foreign predict r5 estimates store model5