[R-meta] Model selection: Model matrix not of full rank

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Sat Mar 24 16:11:19 CET 2018

Just as a follow-up to this:

If your data do not support models of such complexity, then I don't think any model selection approach makes sense. In essence, certain model coefficients are not unique estimable, so even if you get something to fit those models, the estimates are essentially arbitary. Maybe you can exclude (via the 'exclude' argument in glmulti()) certain interactions for which there is not much support a priori.

By the way, as far as I can tell, the 'as.formula(paste(deparse(formula)))' part is unnecessary. I know I had something along those lines in the code here:


at some point, but then realized that things work smoothly with just 'formula' and since then simplified the code.


-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of Cesar Terrer Moreno
Sent: Tuesday, 13 March, 2018 18:29
To: Michael Dewey
Cc: r-sig-meta-analysis at r-project.org
Subject: Re: [R-meta] Model selection: Model matrix not of full rank

Dear Michael,

Thanks for your comments. It’s a pity I can’t include more predictors, when the reality is that the set of potential important predictors is large, and interactions are likely.

Is there any alternative (e.g. Bayesian) to this approach to use model selection with an rma model? 


> On 12 Mar 2018, at 14:26, Michael Dewey <lists at dewey.myzen.co.uk> wrote:
> Dear Cesar
> Comments inline
> On 12/03/2018 10:45, Cesar Terrer Moreno wrote:
>> Hi, I am running a model selection analysis using metafor and glmulti in order to find the most important predictors driving an effect size:
>> rma.glmulti <- function(formula, data, ...) {
>>   rma(as.formula(paste(deparse(formula))), var, data=data, method="ML", knha=TRUE,  control=list(stepadj=.5),...)
>> }
>> res.ECM <- glmulti(es ~ CNr + ph + MAT + MAP + deltaco2 + Biome,
>>                    dat=ecmdat,level=2, fitfunction=rma.glmulti, crit="aicc", confsetsize=2^6)
>> I know the number of moderators is probably too high for a model with interactions (level=2), but anyway after a while running the process I got this error:
> I suspect your observation is probably correct. Can you fit the model with rma.uni using (CNr + ph + MAT + MAP + deltaco2 + Biome)^2 as the formula?
>> Error in rma(as.formula(paste(deparse(formula))), var, data = data, method = "ML",  :
>>   Model matrix not of full rank. Cannot fit model.
>> In addition: There were 50 or more warnings (use warnings() to see the first 50)
> What were the warnings?
>> How can I avoid this error to make the whole process run until the end? It seems like an error unrelated to metafor or glmulti, but I can’t really find a solution to this error.
> I think you may have to choose a simpler model. I think your comment is probably correct, this is a general problem of model complexity not specific to the particular packages you are using.
>> Thanks

More information about the R-sig-meta-analysis mailing list