我正在从一组交互系数估计泊松模型,BMA 包的 bic.glm 有助于导航模型空间。我已经使用它多年了,但是当我昨晚将 R 从 2.10.x 更新到 2.14.2 时,它停止了工作。这是错误:首先,一个有效的调用:
> glm(formula(Y~.), data=XY5, family=poisson)
Call: glm(formula = formula(Y ~ .), family = poisson, data = XY5)
Coefficients:
<results, etc>
现在 bic.glm 失败:
> bic.glm(formula(Y~.), data=XY5, glm.family=poisson, model=TRUE)
Error in terms.formula(formula, data = data) :
'.' in formula and no 'data' argument
同样,这个确切的代码在具有五个系统的早期版本的 R 中工作。当我使用 4 个交互系统而不是 5 个运行 bic.glm(即,删除 x5 并折叠交互)时,bic.glm 运行良好。我将在下面包括五个系统数据。提前致谢。
> XY5
x1 x2 x3 x4 x5 x12 x13 x14 x15 x23 x24 x25 x34 x35 x45 x123 x124 x125 x134 x135 x145
2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
5 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
7 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
8 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0
9 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
11 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
12 0 1 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0
13 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
14 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0
15 0 1 1 1 0 0 0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