I've tried lm, but something is wrong.
I've made a test dataset of 599 data points, my original equation is

zz = 1 +0.5*xx -3.2*xx*xx -1*yy +4.2*yy*yy

but the R gives this result:
-------------------------------------------------------
> mp <- read.csv(file="sample.csv",sep=";",header=TRUE)
> lm(zz ~ poly(xx,2) + poly(yy,2), data=mp)

Call:
lm(formula = zz ~ poly(xx, 2) + poly(yy, 2), data = mp)

Coefficients:
 (Intercept)  poly(xx, 2)1  poly(xx, 2)2  poly(yy, 2)1  poly(yy, 2)2  
       25.86      -2239.86       -595.01       2875.54        776.84
-----------------------------------------------------------
which is definitely not the original. :(

(In case of interest the test dataset is available here:
szisziszilvi.lima-city.de/r)
-- 
View this message in context: 
http://r.789695.n4.nabble.com/non-linear-regression-for-3D-data-tp2320982p2322779.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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