On 11/08/2010 6:15 AM, szisziszilvi wrote:
Hello!

Is there a simplier way in R to get a nonlinear regression (like nls) for a
surface? I have 3D data, and it is definitely not a linear surface with
which it would fit the best. Rather sg like z = a + f(x) + g(y) where
probably both f and g are polinomes (hopefully quadratic).

That's a linear model if f and g are polynomials.  You can fit it with

lm(z ~ poly(x, 2) + poly(y, 2))

The 2's are the degrees of each polynomial; the intercept a is implied.

Duncan Murdoch

______________________________________________
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.

Reply via email to