我正在与loglm(count~A+B+C+D+E, data=whatever)
.
我的问题是我想计算所有效果的每种可能组合。即:A 和 A+A:B 和 A+C+C:B+A:B:C:D:E 等等进入(看似)无穷大。
有什么建议么?
编辑数据看起来像
df <- structure(list(count = c(0L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L),
A = c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L), B = c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L), C = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L),
D = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L), E = c(1L, 1L, 2L, 2L, 1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 2L, 1L)), .Names = c("count", "A", "B", "C", "D", "E"),
class = "data.frame", row.names = c(NA, -29L))
我得到的问题是:
> data(SampleData)
Warning message:
In data(SampleData) : data set ‘SampleData’ not found
> fm1 <- loglm(count ~ ., data = SampleData)
> dd <- dredge(fm1)
Error in rownames(ct)[match(names(coef1), rownames(ct))] <- fxdCoefNames :
NAs are not allowed in subscripted assignments
In addition: Warning messages:
1: In table(fac) : attempt to set an attribute on NULL (model 1 skipped)
2: In data[do.call("cbind", lapply(fac, as.numeric))] <- rsp :
number of items to replace is not a multiple of replacement length
3: In st[do.call("cbind", lapply(fac, as.numeric))] <- exp(offset) :
number of items to replace is not a multiple of replacement length
4: In double(nmar) : vector size cannot be NA/NaN (model 2 skipped)
5: In data[do.call("cbind", lapply(fac, as.numeric))] <- rsp :
number of items to replace is not a multiple of replacement length
6: In st[do.call("cbind", lapply(fac, as.numeric))] <- exp(offset) :
number of items to replace is not a multiple of replacement length
7: In double(nmar) : vector size cannot be NA/NaN (model 3 skipped)
> subset(dd, delta < 4)
Error in subset(dd, delta < 4) : object 'dd' not found