1

当使用 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

4

1 回答 1

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")并提交错误报告......

于 2013-05-10T15:11:31.467 回答