[R] is there a way to visualize 3D normal distributions?

Ben Bolker bolker at zoo.ufl.edu
Thu Feb 2 23:55:47 CET 2006


Michael wrote:
> shape3d only gives rigid sphere... not the free form ellipsoid that I 
> want...
> 

   one or the other of us is missing something.

    after running demo(shapes3d)
[to define ellipsoid3d] and rgl.clear(),

s1 <- ellipsoid3d(qmesh = TRUE, trans = diag(4))
shade3d(rotate3d(scale3d(s1, 1, 1, 2),
                  angle=pi/4, x=0, y=1, z=0),
         col = "red")
axis3d()

  produces an ellipsoid with radii (1,1,2) rotated by pi/4 around
the y axis.  I'm too lazy to figure out how to
translate a variance-covariance matrix into
a scaling/rotation matrix (the scale will want
to be something like eigen(v)$values*qnorm(0.975)
for a 95% contour, the rotation matrix is some
function of the eigenvectors), but it seems to
me that this will produce any ("free form"?) ellipsoid
you want.

   cheers
     Ben Bolker




More information about the R-help mailing list