version 12.1 use https://www3.nd.edu/~rwilliam/statafiles/nonlinhw.dta, clear ********** Part 1. * Plot of x1 with y1 estimates clear scatter y1 x1, scheme(sj) curvefit y1 x1, f(1 4) * HW: Show another way to graph this model * HW: Show how to estimate this model using regress and/or glm ********** Part 2. * Plot of x1 with y2 estimates clear scatter y2 x1 curvefit y2 x1, f(1 0) * HW: Show how to estimate this model using regress and/or glm ********** Part 3. * Plot of x1 with y3. estimates clear scatter y3 x1 mkspline xle0 0 xgt0 = x1, marginal reg y3 x1 predict linear reg y3 xle0 xgt0 predict spline scatter y3 x1 || line linear x1 || line spline x1, sort scheme(sj) ******** Part 4. * As this shows, a polynomial model would also be plausible for y3. * In practice, it is often hard to tell just from the scatterplot what * transformation is best, so theory is important. estimates clear curvefit y3 x1, f(1 4)