2015-06-13 52 views

回答

3

一種方法是使用bilinear interpolationkde2d返回電網:

library(fields) 
points <- data.frame(x=0:2, y=c(0, 5, 5)) 
interp.surface(k, points) 
# [1] 0.066104795 0.040191482 0.001943069 

數據:

library(MASS) 
set.seed(144) 
x <- rnorm(1000) 
y <- 5*x + rnorm(1000) 
k <- kde2d(x, y)