Here's my little discussion example for a quadratic regression: http://pj.freefaculty.org/R/WorkingExamples/regression-quadratic-1.R
Students press me to know the benefits of poly() over the more obvious regression formulas. I think I understand the theory on why poly() should be more numerically stable, but I'm having trouble writing down an example that proves the benefit of this. I am beginning to suspect that because R's lm uses a QR decomposition under the hood, the instability that we used to see when we inverted (X'X) is no longer so serious as it used to be. When the columns in X are x1 x2 x3 x3squared then the QR decomposition is doing about the same thing as we would do if we replaced x3 and x3squared by the poly(x3, 2) results. Or not. I'm not arguing that, I'm thinking out loud, hoping you'll correct me. pj -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.