* * Example 8.9 from page 282 * open data gpa1.raw data(format=free,org=columns) 1 141 age soph junior senior senior5 male campus business engineer $ colgpa hsgpa act job19 job20 drive bike walk voluntr pc greek car siblings bgfriend clubs $ skipped alcohol gradmi fathcoll mothcoll * * Generate PARCOLL (at least one parent attended college) from FATHCOLL and * MOTHCOLL. This uses the .OR. operator, which evaluates to 1 if either FATHCOLL * or MOTHCOLL is non-zero, and to zero if both are zero. * set parcoll = fathcoll.or.mothcoll * linreg pc # constant hsgpa act parcoll linreg(robust) pc # constant hsgpa act parcoll * * Do LPM-specific correction for heteroskedasticity * prj predict * * Check to see what the range is on the predicted values * ext predict * * This is how you'd patch over values, if you needed to. It uses the * %IF(condition,if true,if false) function; in fact, two of them nested. * set predict = %if(predict<0.0,.01,%if(predict>1.00,.99,predict)) * linreg(spread=predict*(1-predict)) pc # constant hsgpa act parcoll