On 24/09/2008 11:11 AM, Duncan Murdoch wrote:
On 24/09/2008 10:12 AM, Michael Friendly wrote:
Duncan Murdoch wrote:
The normals component contains the surface normals. It is used to
help in rendering the surface, but isn't much use for your purposes.
Unfortunately, I'm not familiar enough with the internals of princomp
to tell you how to get the axes you want.
Duncan Murdoch
OK, then let me repharase it. The axes of the unit sphere are like
axes <- matrix(
c(0, 0, -1, 0, 0, 1,
0, -1, 0, 0, 1, 0,
-1, 0, 0, 1, 0, 0), 6, 3, byrow=TRUE)
taken in pairs. I'd like to transform these coordinates the same was as
in ellipse3d() and add them to the plot.
That's easy, but it doesn't give you the principal axes of the ellipse.
Just use
axes %*% chol(cov)
If you start with a unit sphere, this will give you points on its
surface, but not the ones you want. For those you need the SVD or
eigenvectors. This looks like it does what you want:
axes <- matrix(
c(0, 0, 0, # added origin
0, 0, -1, 0, 0, 1,
0, -1, 0, 0, 1, 0,
-1, 0, 0, 1, 0, 0), 7, 3, byrow=TRUE)
axes <- axes[c(1,2,1,3,1,4,1,5,1,6,1,7),] # add the origin before each
Why did I add the origin? It's not needed, your axes were fine. Sorry.
Duncan Murdoch
______________________________________________
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.