[R] non-linear regression for 3D data

szisziszilvi sziszi.szilvi at gmail.com
Thu Aug 12 16:35:00 CEST 2010


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.



More information about the R-help mailing list