Hello. I am trying to plot a 3d surface given its equation. The R code is written in blue. So, let's say that I have the points x,y,z and I plot them. Also, I compute its regression surface doing polynomical regression (fit)
library('rgl') x <- c(-32.09652, -28.79491, -25.48977, -23.18746,-20.88934, -18.58220, -17.27919) y <- c(-32.096, -28.794, -25.489, -23.187,-20.889, -18.582, -17.279) z <- c(12.16344, 28.84962, 22.36605, 20.13733, 79.50248, 65.46150,44.52274) plot3d(x,y,z, type="s", col="red", size=1) fit <- lm(z ~ poly(x,2) + poly(y,2)) In this way, I obtain the coefficients of the surface coef(fit) (Intercept) poly(x, 2)1 poly(x, 2)2 3.900045e+01 1.763363e+06 6.683531e+05 poly(y, 2)1 poly(y, 2)2 -1.763303e+06 -6.683944e+05 So I want to repressent the surface 3.900045e+01 +1.763363e+06*x + 6.683531e+05*x*x -1.763303e+06*y-6.683944e+05*y*y How could I do it? Any idea?? Thank you very much! ------ Aurora González Vidal Sección Apoyo Estadístico. Servicio de Apoyo a la Investigación (SAI). Vicerrectorado de Investigación. Universidad de Murcia Edif. SACE . Campus de Espinardo. 30100 Murcia @. aurora.gonzal...@um.es T. 868 88 7315 F. 868 88 7302 www.um.es/sai www.um.es/ae [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.