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

From: Duncan Murdoch <>
Date: Fri 03 Feb 2006 - 10:21:33 EST

On 2/2/2006 5:01 PM, Michael wrote:
> shape3d only gives rigid sphere... not the free form ellipsoid that I
> want...

? If you run the demo, you'll see ellipsoids...

You just need to work out the appropriate transform to apply to a sphere to get the ellipsoid you want. I imagine something like this:

sphere <- ellipsoid3d(2,2,2, qmesh=TRUE) ellipsoid <- translate3d(rotate3d(sphere, matrix=chol(S)), xbar, ybar, zbar)


is what you want, where S is the covariance matrix, and xbar,ybar,zbar have the obvious meaning. (rotate3d() is used with a matrix that isn't a rotation matrix; it may not be obvious that this is allowed, but it is.)

Duncan Murdoch

> On 2/2/06, Ben Bolker <> wrote:

>> Duncan Murdoch <murdoch <at>> writes:
>>> On 2/2/2006 3:39 AM, Michael wrote:
>>>> Hi all,
>>>> How do I visualize a contour of a tri-variate normal distribution?
>>>> I just like to see the ellipsoid very much. I hope there is a easy way
>> or
>>>> existing method in R.
>>> The misc3d package includes a function for 3d contour plots; that should
>>> do what you want.
>>   is contour3d really necessary or could you just plot ellipsoids?
>> (library(rgl); demo(shapes3d)) -- still a little bit of figuring
>> to do, but this should get you most of the way there.
>>   Ben Bolker
>> ______________________________________________
>> mailing list
>> PLEASE do read the posting guide!

> [[alternative HTML version deleted]]
> ______________________________________________
> mailing list
> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Fri Feb 03 10:28:06 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:19 EST