~lp()之间的差异或简单地在R的locfit中

时间:2022-10-14 20:13:38

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

这是在第一次发布在stats.stackexchange.com之后的交叉发布,因为我认为它涉及更多地使用R和统计而不是编码,但现在我看到我可能会在这里找到一个更活跃的R用户社区。 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

我不确定我在R的黄金标准locfit包的文档中看到了本地逻辑回归的不同示例之间的区别: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...

差异的本质是什么?也许这可以帮助我说出我想要的短语。我想到了一个逻辑链接函数中的bl线性索引,用于预测closed_rule的概率。 lp的文档说它适合局部多项式 - 这很好,但我认为即使我把它遗漏也会发生。无论如何,文档中都有“本地逻辑回归”的例子......

1 个解决方案

#1


1  

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.

locfit包的作者Catherine Loader亲切地回复了我的电子邮件。她说,如果我在scb的公式中指定它,而不是scb的alpha参数,单独的h和nn参数需要进入lp。

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.

我无法让代码以这种方式工作。而且我仍然不确定为什么在没有指定lp()和简单地给scb函数提供alpha和deg参数的情况下应该与情况有所不同。

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.

并且她还注意到我的代码发布的一个重要错误:使用'parm'内核,没有局部平滑,而是参数(在我的情况下,逻辑)估计。

Finally, note that the literature seems to suggest specifying type=4 as an argument for scb for logistic regressions.

最后,请注意文献似乎建议将type = 4指定为逻辑回归的scb参数。

#1


1  

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.

locfit包的作者Catherine Loader亲切地回复了我的电子邮件。她说,如果我在scb的公式中指定它,而不是scb的alpha参数,单独的h和nn参数需要进入lp。

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.

我无法让代码以这种方式工作。而且我仍然不确定为什么在没有指定lp()和简单地给scb函数提供alpha和deg参数的情况下应该与情况有所不同。

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.

并且她还注意到我的代码发布的一个重要错误:使用'parm'内核,没有局部平滑,而是参数(在我的情况下,逻辑)估计。

Finally, note that the literature seems to suggest specifying type=4 as an argument for scb for logistic regressions.

最后,请注意文献似乎建议将type = 4指定为逻辑回归的scb参数。