[R] Problems with 2-D Kernel Density Estimation using MASS & KernSmooth
chanchal at biochem.mpg.de
Mon Sep 4 17:59:07 CEST 2006
I am using the two dimensional Kernel density estimation function in
"MASS" package (specifically "kde2d") and am having a recurrent problem.
The problem is that when my data vectors have less then 30000 entries
then the functions gives me the density estimate. But when the vector
size increases beyond 30000 then I get an error. I have pasted below my
steps and the error message.
>dens<-kde2d(data3[],data3[], h = c(width.SJ(data3[],nb=100,
+method="dpi"), width.SJ(data3[], nb=100,method="dpi")), n=N,
When data3[] and data3[] are each less then 30000 entries then the
function runs fine else it gives me following error message:
>Error in SDh(cnt, (2.394/(n * TD))^(1/7), n, d) : NA/NaN/Inf in foreign
function call (arg 5)
I also tried using the "bkde2D" from "KernSmooth" package and am getting
the same error for longer vector sizes.
I shall be thankful if you could suggest what is going wrong.
Alternatively I will be glad to know about other possible ways of fast
density estimation on bigger vectors. Thanks in advance!
Chanchal Kumar, Ph.D. Candidate
Dept. of Proteomics and Signal Transduction
Max Planck Institute of Biochemistry
Am Klopferspitz 18
82152 D-Martinsried (near Munich)
e-mail: chanchal at biochem.mpg.de
Phone: (Office) +49 (0) 89 8578 2296
Fax:(Office) +49 (0) 89 8578 2219
More information about the R-help