【问题标题】:Can no longer return beta coefficients using MuMIn package in R不能再使用 R 中的 MuMIn 包返回 beta 系数
【发布时间】:2013-05-10 13:37:10
【问题描述】:

当使用 R 包 MuMIn (v1.9.5) 和命令 dredge 时,beta = TRUE 开关不再按预期工作。

# load Cement data set with MuMIn package
data(Cement)

# build global model
fmd <- lm(y ~ X1 + X2 + X3 + X4, data = Cement)

# dredge global model without returning standardized coefficients (default); 
# WORKING

ms1 <- dredge(fmd)

# dredge global model and return standardized coefficients; 
# NOT WORKING

ms1 <- dredge(fmd, beta = TRUE)

后者返回:

Error in dimnames(ret) <- list(names(model$coefficients), c("Estimate",  : 
  length of 'dimnames' [1] not equal to array extent

使用 R v3.0.0

【问题讨论】:

    标签: r mumin


    【解决方案1】:

    已通过 MuMIn 1.9.5 确认 ...beta.weights() 函数中似乎存在错误。

    第四行,

     coefmat <- coefTable(model)[, 1L:2L]
    

    应该是

     coefmat <- coefTable(model)[, 1L:2L, drop=FALSE]
    

    您可以暂时自行修复此问题,如下所示:

    fix(beta.weights)
    ## opens an editor; make the change in the editor and save/exit
    assignInNamespace("beta.weights",beta.weights,"MuMIn")
    

    但是,联系包维护者肯定是个好主意(请参阅help(package="MuMIn") 并提交错误报告...

    【讨论】:

      猜你喜欢
      • 2014-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-17
      • 1970-01-01
      • 2020-10-18
      • 1970-01-01
      相关资源
      最近更新 更多