Dear All,
I am researching financial market microstructure and have approx 4 x
10^7 multivariate 2D data samples which I have counted into a 250 x 390
bin matrix (frequency counted 2D histogram) in order to more efficiently
manage the volume of data.
I now wish to construct a smooth kernel density estimate (Gaussian
kernel function) using this binned data.
Does anyone in the R community know of an R function (or S-plus or
Mathematica or Matlab or C++ or even Fortran) to do this.
(Note that bkde2D, ash2 etc will not work with binned data input and
using 4 x 10^7 raw samples on a 0(n^2) algorithm is probably not
feasible)
Thanks in advance.
Regards,
James McCulloch
Post-Doc Fellow
University of Technology Sydney
DISCLAIMER\ ================================================...{{dropped}}
Nicholas Lewin-Koh
2004-Feb-12 08:56 UTC
[R] RE: Kernel Density Estimator for 2D Binned Data
Hi James, You can try the hexbin package at www.bioconductor.org. Do the following bin<-hexbin(x,y) ## This will give you hexagonal bins of the data binsm<-smooth.hexbin(bin) plot(binsm) This is an approximation to what you want. The other way is to use a 2d bspline on the bin center of masses of the hexagons and use the bin counts as weights. Nicholas