Benjamin Jones
Benjamin Jones

Reputation: 1

Errors with dredge() function in MuMin

I'm trying to use the dredge() function to evaluate models by completing every combination of variables (up to five variables per model) and comparing models using AIC corrected for small sample size (AICc).

However, I'm presented with one error and two warning messages as follows:

Fixed term is "(Intercept)" Warning messages: 1: In dredge(MaxN.model, m.min = 2, m.max = 5) : comparing models fitted by REML 2: In dredge(MaxN.model, m.min = 2, m.max = 5) : arguments 'm.min' and 'm.max' are deprecated, use 'm.lim' instead

I've tried changing to 'm.lim' as specified but it comes up with the error:

Error in dredge(MaxN.model, m.lim = 5) : invalid 'm.lim' value In addition: Warning message: In dredge(MaxN.model, m.lim = 5) : comparing models fitted by REML

The code I'm using is:

MaxN.model<-lme(T_MaxN~Seagrass.cover+composition.pca1+composition.pca2+Sg.Richness+traits.pca1+
              land.use.pc1+land.use.pc2+seascape.pc2+D.landing.site+T_Depth, 
                random=~1|site, data = sgdf, na.action = na.fail, method = "REML")
Dd_MaxN<-dredge(MaxN.model, m.min = 2 , m.max = 5)

What am I doing wrong?

Upvotes: 0

Views: 2333

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226182

  1. You didn't tell us what you tried to specify for m.lim. ?dredge says:

m.lim ...optionally, the limits ‘c(lower, upper)’ for number of terms in a single model

so you should specify a two-element numeric (integer) vector.

  1. You should definitely be using method="ML" rather than method="REML". The warning/error about REML is very serious; comparing models with different fixed effects that are fitted via REML will lead to nonsense.

So you should try:

MaxN.model <- lme(..., method = "ML")  ## where ... is the rest of your fit
Dd_MaxN <- dredge(MaxN.model, m.lim=c(2,5))

Upvotes: 1

Related Questions