Difference between ~lp() or simply ~ in R's locfit
This is cross-posted after having first posted on stats.stackexchange.com, as I thought it involves more the use of R and statistics than coding, but now I see that I might find a more lively community of R users here. https://stats.stackexchange.com/questions/16346/difference-between-lp-or-simply-in-rs-locfit
I am not sure I see the difference between different examples for local logistic regression in the documentation of the gold standard locfit package for R: http://cran.r-project.org/web/packages/locfit/locfit.pdf
I get starkingly different results with
fit2<-scb(closed_rule ~ lp(bl),deg=1,xlim=c(0,1),ev=lfgrid(100), family='binomial',alpha=cbind(0,0.3),kern="parm")
from
fit2<-scb(closed_rule ~ bl,deg=1,xlim=c(0,1),ev=lfgrid(100), family='binomial',alpha=cbind(0,0.3),kern="parm")
.
What is the nature of the difference? Maybe that can help me phrase which I wanted. I had in mind an index linear in bl within a logistic link function predicting the probability of closed_rule. The documentation of lp says that it fits a local polynomial -- which is great, but I thought that would happen even if I leave it out. And in any case, the documentation has 开发者_运维技巧examples for "local logistic regression" either way...
The author of the locfit package, Catherine Loader, kindly answered my email. She says that instead of the alpha argument of scb, separate h and nn arguments need to go inside lp if I specify it within the formula for scb.
I could not get the code work that way though. And I am still unsure about why there should a difference from the case without specifying lp() and simply giving the alpha and deg arguments to the scb function.
And she also noted an important error my code as posted: with the 'parm' kernel, there is no local smoothing, but a parametric (in my case, logic) estimate.
Finally, note that the literature seems to suggest specifying type=4 as an argument for scb for logistic regressions.
精彩评论