我正在尝试在R中执行内核逻辑回归。是否有包执行此操作?
答案 0 :(得分:2)
stats::ksmooth
为您提供Nadaraya-Watson内核回归:
with(cars, {
plot(speed, dist>40)
lines(ksmooth(speed, dist>40, "normal", bandwidth = 2), col = 2)
lines(ksmooth(speed, dist>40, "normal", bandwidth = 6), col = 3)
})