[R-sig-Geo] 3D kde output conversion to volume

kalee kathryn.lee1 at students.mq.edu.au
Thu Jan 19 11:28:56 CET 2012


Hi 

I'm trying to calculate the volume of a 3D kernel density estimator that has
been calculated using the kde command from the ks package. So far I'm just
working with the examples given before applying this to my own data so only
have that example data to give (found under "plot" of the package manual): 

## trivariate example 
library(MASS) 
x <- iris[,1:3] 
H.pi <- Hpi(x, pilot="samse") 
fhat <- kde(x, H=H.pi, compute.cont=TRUE) 
plot(fhat, drawpoints=TRUE) 


Under a previous post about calculating the 2D spatial area of the kde
output (see full original message at the end) the following was suggested by
Michael Sumner: 

"Here's one way: 

library(ks) 

data(unicef) 
H.scv <- Hscv(x=unicef) 
fhat <- kde(x=unicef, H=H.scv) 
image(fhat$eval.points[[1]], fhat$eval.points[[2]], fhat$estimate) 


library(sp) 


spkde <- image2Grid(list(x = fhat$eval.points[[1]], y = 
fhat$eval.points[[2]], z = fhat$estimate)) 
contour(spkde, add = TRUE)  " 

- How would this above method be applied to a 3D kde output? How would you
calculate the kde output at specific contour levels? Such as the 95% or 50%
contour levels. The original R-sig-geo post quoted a wiki page that seems to
have subsequently removed the posting about image2Grid. 

Many thanks, 
Kathryn 


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/3D-kde-output-conversion-to-volume-tp7203184p7203184.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list