문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top