[R-sig-eco] 3d fitting plane

Paolo Piras paolo.piras at uniroma3.it
Tue Jan 19 15:40:55 CET 2016


I tried using prcomp():

library(compositions)
library(rgl)
x <- rnorm(100)
y <- rnorm(100)
z <- rnorm(100)
mat<-cbind(x,y,z)
plot3D(mat,col=3,bbox=F)
pr<-prcomp(mat)
planes3d(pr$rotation[3,1]*sign(pr$rotation[3,1]),pr$rotation[3,2]*sign(pr$rotation[3,2]),pr$rotation[3,3]*sign(pr$rotation[3,3]),alpha=0.5,col=3,bbox=F)
decorate3d()

It seems fine; any advice is welcome
best
paolo


________________________________________
Da: R-sig-ecology <r-sig-ecology-bounces at r-project.org> per conto di Paolo Piras <paolo.piras at uniroma3.it>
Inviato: martedì 19 gennaio 2016 14.46
A: r-sig-ecology at r-project.org
Oggetto: [R-sig-eco] 3d fitting plane

Hi folks,
I look for a fast way to estimate a 3d fitting plane to my 3d data.
I do not want z~y+x as this is a regression model.
I just want the equation of the best plane that fits the data in 3d. Maybe using princomp() and Total least squares?
Looking around I found some solutions but nothing definitive.
Thanks in advance for any suggestion.
best
paolo

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


More information about the R-sig-ecology mailing list