我正在尝试运行glmulti来测试所有可能的子集以进行模型选择。以下是我尝试使用的代码。
lmer.glmulti<-function(formula, data, random="", ...){
lmer(paste(deparse(formula),random),data=data,
REML=FALSE,...)
}
glmulti <-
glmulti(formula(lmer(transLOT~DielEnd+TidalHeight+Pier+PercentIllumination+WT+BP+Anglers+(1|Transmitter), data=RESIDENCY_FOR_R), fixed.only=TRUE),
data=RESIDENCY_FOR_R,
level = 1,
method = "h",
crit = "bic",
confsetsize = 5,
plotty = F, report = F,
fitfunc = lmer.glmulti,
random="+(1|Transmitter)",
intercept=TRUE)
变量组合出现问题。在我的输出中,第4个和第5个模型相同(请参见下文),并且在“ Pier”和“(1 | Transmitter)”之间有一个空白。
[[4]]
Linear mixed model fit by maximum likelihood ['lmerMod']
Formula: RESIDENCY_FOR_R$transLOT ~ 1 + DielEnd + TidalHeight + Pier + +(1 | Transmitter)
Data: data
AIC BIC logLik deviance df.resid
2522.600 2558.928 -1253.300 2506.600 685
Random effects:
Groups Name Std.Dev.
Transmitter (Intercept) 0.2361
Residual 1.4686
Number of obs: 693, groups: Transmitter, 9
Fixed Effects:
(Intercept) DielEndNight TidalHeightRising PierGarden City Pier PierMBSP Pier
2.86894 -0.62946 0.08668 -1.38613 0.88502
PierPier 14
-0.77364
[[5]]
Linear mixed model fit by maximum likelihood ['lmerMod']
Formula: RESIDENCY_FOR_R$transLOT ~ 1 + DielEnd + TidalHeight + Pier + +(1 | Transmitter)
Data: data
AIC BIC logLik deviance df.resid
2522.600 2558.928 -1253.300 2506.600 685
Random effects:
Groups Name Std.Dev.
Transmitter (Intercept) 0.2361
Residual 1.4686
Number of obs: 693, groups: Transmitter, 9
Fixed Effects:
(Intercept) DielEndNight TidalHeightRising PierGarden City Pier PierMBSP Pier
2.86894 -0.62946 0.08668 -1.38613 0.88502
PierPier 14
-0.77364
如果有人可以帮助您,将不胜感激。