Search code examples
rlogistic-regression

Can you perform a Kernel Logistic Regression in R


I am trying to perform a Kernel Logistic Regression in R. Is there a package that does this?


Solution

  • stats::ksmooth gives you the Nadaraya–Watson kernel regression:

    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)
    })
    

    enter image description here