c - R 的 hier.part() 取决于预测器顺序

标签 c r glm

我尝试使用 hier.part R 包(它是 hier.part() 函数)来估计变量的独立贡献。突然之间,我对预测顺序产生了强烈的依赖。

有一篇论文 ( http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0011698 ) 报告了超过 9 个预测变量的类似行为。包的文档还报告了 9-12 个预测变量的“较小舍入误差”。但即使在具有 4 个自变量的包示例中,我也经历过这种情况。

> library(hier.part)
> data(amphipod)
> env1 <- amphipod[,2:5]
> hier.part(amphipod$australis, env1, fam = "binomial",
+           gof = "logLik", barplot=F)$I.perc
              I
fimp   19.74685
fconn  18.24679
densep 25.24765
unseal 36.75871
> hier.part(amphipod$australis, env1[,c(4,3,2,1)], fam = "binomial",
+           gof = "logLik", barplot=F)$I.perc
              I
unseal 16.16072
densep 17.98755
fconn  32.00246
fimp   33.84927

此外,调用之间的确切值并不稳定。该函数使用C代码(在partition()调用中),并且至少“调用之间的稳定性”问题可以归因于它,因为所有相关的R代码都是确定性的。

最佳答案

这次你的问题在我的R中没有显示出来,两个I$perc是一样的。-晨曦

关于c - R 的 hier.part() 取决于预测器顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38750067/

相关文章:

c - 设置消息队列大小 "not permitted"

r - 如何在 Power Query 中使用 R 转换步骤获取线性回归模型参数

r - 在 R glm 模型中选择具有统计意义的变量

r - R : Pass argument to glm inside an R function

C OpenMP - 强制执行默认 block 大小

c - 结构数组 - sizeof 返回意外结果

c - 为什么 char* 在 C 中被视为与 char** 相同?

r - 编织器:R包检查错误,未找到对象 'opts_chunk'

r - 模糊连接2个大数据框

r - 自定义链接功能适用于 GLM 但不适用于 mgcv GAM