I've estimated the density of old faithful using:
library(np)
library(datasets)
data(faithful)
f <- npudens(~eruptions+waiting,data=faithful)
How do I find the density of a point not in faithful? Thanks!
?npudens
says that npdensity
objects have a predict
method:
predict(f,newdata=data.frame(eruptions=3.5,waiting=70))
## [1] 0.004473444