[R] Adding axis to an ellipse: "ellipse" package

Antoine antoine.paccard at unine.ch
Sat Oct 1 12:26:11 CEST 2011


Dear Rolf,

I tryed to follow your advices but the results I am getting seems still
strange to me. See below an example of a matrix:

datamat <- matrix(c(2.2, 0.4, 0.4, 2.8), 2, 2)
plot(ellipse(datamat),type='l')
eigenval <- eigen(datamat)$values
eigenvect <- eigen(datamat)$vectors
eigenscl  <- eigenvect * sqrt(eigenval) * (qchisq(0.95,2))# One solution to
get rescale

v1 <- (eigenvect[,1])*(sqrt(eigenval[1]))*(qchisq(0.95,2))#or directly
rescale the vectors needed
v2 <- (eigenvect[,2])*(sqrt(eigenval[2]))*(qchisq(0.95,2))
#Or
v1 <- eigenscl[1,]
v2 <- eigenscl[2,]
segments(-v1[1],-v1[2],v1[1],v1[2])
segments(-v2[1],-v2[2],v2[1],v2[2])

The vectors don't seem to be scaled properly and I don't see what I am doing
wrong. Any ideas?

Thanks!
Antoine

--
View this message in context: http://r.789695.n4.nabble.com/Adding-axis-to-an-ellipse-ellipse-package-tp3847954p3862491.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list