I am attempting to run glmulti to test all possible subsets for model selection. The following is the code that I am trying to use.
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)
A problem arises with the variable combinations. In my output, the 4th and 5th models are the same (see below) and there is a blank in-between "Pier" and "(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
If anyone could help that would be greatly appreciated.
来源:https://stackoverflow.com/questions/50952828/model-selection-using-glmulti