Question

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!

Was it helpful?

Solution

?npudens says that npdensity objects have a predict method:

predict(f,newdata=data.frame(eruptions=3.5,waiting=70))
## [1] 0.004473444
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top