我正在做一些探索性工作,我使用疏浚{MuMIn}。在此过程中,我想将两个变量设置为仅在它们之间存在相互作用时才允许一起使用,即它们不能仅作为主要影响一起存在。
使用示例数据:我想疏通模型 fm1(尽管它可能没有意义)。如果变量 GNP 和 Population 一起出现,它们还必须包括它们之间的交互作用。
require(stats); require(graphics)
## give the data set in the form it is used in S-PLUS:
longley.x <- data.matrix(longley[, 1:6])
longley.y <- longley[, "Employed"]
pairs(longley, main = "longley data")
names(longley)
fm1 <- lm(Employed ~GNP*Population*Armed.Forces, data = longley)
summary(fm1)
dredge(fm1, subset=!((GNP:Population) & !(GNP + Population)))
dredge(fm1, subset=!((GNP:Population) && !(GNP + Population)))
dredge(fm1, subset=dc(GNP+Population,GNP:Population))
dredge(fm1, subset=dc(GNP+Population,GNP*Population))
我如何指定dredge()
它应该忽略存在 GNP 和人口的所有模型,但不考虑它们之间的相互作用?