[R] Solving quadratic functions

Thomas Lumley tlumley at u.washington.edu
Tue Mar 5 00:19:08 CET 2002

On Tue, 5 Mar 2002 Peter.Watkins at foodscience.afisc.csiro.au wrote:

> I'm examining the use of the 'lm' function to solve quadratic functions.
> With S+ 2000, the 'lm' function can be used to solve eqns such as x1 + x2 +
> x1^2 + x2^2 + x1*x2.
> But, when trying this same eqn with R, the software does not produce any
> coefficients for x1^2 or x2^2.
> Is this a common problem?

Well, it's a FAQ

Differences between R & S: Models
   Whereas in S, you would use lm(y ~ x^3) to regress y on x^3, in R, you
   have to insulate powers of numeric vectors (using I()), i.e., you have
   to use lm(y ~ I(x^3)).


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list