Peter.Watkins@foodscience.afisc.csiro.au
2002-Mar-04 22:37 UTC
[R] Solving quadratic functions
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? I'm using ver. 1.3.1 under Win. 2000. Thanks, Peter -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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)). -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._