Skip to content

3D density estimation

1 message · Liaw, Andy

#
I believe the sm package has functions for estimating (and even plotting?)
3D kernel density estimates.

Another possibility is the locfit package (currently in the "devel" section
on CRAN, because it hasn't been updated for the latest version of R, but may
still largely work).

(Both of these packages are companion software for books, so you may want to
check out those books.)

HTH,
Andy

-----Original Message-----
From: Chris Knight
[mailto:christopher.knight at plant-sciences.oxford.ac.uk]
Sent: Monday, December 09, 2002 9:04 AM
To: r-help at stat.math.ethz.ch
Subject: [R] 3D density estimation


I am trying to carry out density estimation for three dimensions 
(with anywhere between a few hundred and ~8000 data points). Which 
leads me to ask:

a) is there any equivalent to kde2d (in MASS) or bkde2D (in 
KernSmooth) out there for three dimensions?

b) if not, my skills only seem to extend as far as writing a function 
which measures density as the number of data points falling within a 
sphere at each point on a 3D grid. The results for  spheres of the 
minimum size to cover all the space (i.e. slightly intersecting) on a 
30x30x30 mesh don't seem too bad.
  i) How inadequate is such an analysis likely to be for subsequent 
comparison of different density distributions?
ii) Is there anything equally simple I could implement which might be 
preferable?

Any help much appreciated,

Chris