[R-meta] errors returned by rma() and rma.mv() when fitting a large dataset

Yefeng Yang ye|eng@y@ng1 @end|ng |rom un@w@edu@@u
Thu May 23 04:36:20 CEST 2024


Dear Wolfgang,

Thank you for your swift reply.

A quick update:


  *
1.  trimfill() function in meta package also returns me the same error. This happened when I fit the RE model using metagen() function:
metagen(TE = mu_adj, seTE = se_adj,
                   studlab = id, data = dat_med,
                   fixed = FALSE, random = TRUE,
                   method.tau = "REML", hakn = TRUE)
  *
I tried selection model implemented in other packages like weight:
weightfunct(effect = dat_med$mu_adj, v = dat_med$se_adj^2, steps = c(0.025), table = TRUE)

          and metasens:
         metagen(mu_adj, se_adj, method.tau="ML", data=dat_med) & copas(res)

Both leads to error caused by the k*k matrices. I did not try what Wolfgang suggested because I do not know how to do it:
"If so, you could take the rma.mv results, stuff them into an object that has the structure of a rma.uni object, and then call selmodel() on that object. "

My ultimate aim is to test whether a dataset has publication bias. I would like to use multiple methods, like Egger's regression, selection model, trim and fill. But now it seems that I can only use Egger's regression (lm() version or rma.mv() version).

What do you think if I randomly sample a certain number of estimates from my big dataset and run selection model and trim-and-fill, and I repeat this many times? Of course, 'a certain number of estimates' should not induce the matrix issue.

Best regards,
Yefeng
________________________________
From: Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer using maastrichtuniversity.nl>
Sent: 22 May 2024 20:09
To: R Special Interest Group for Meta-Analysis <r-sig-meta-analysis using r-project.org>
Cc: Yefeng Yang <yefeng.yang1 using unsw.edu.au>
Subject: RE: errors returned by rma() and rma.mv() when fitting a large dataset

Dear Yefeng,

The problem is that quite a bit of code in metafor works with k*k matrices, where k is the number of estimates. A matrix of that size can quickly get very large, as you can tell.

To fit a RE model, you can use rma.mv() with sparse=TRUE. This will avoid those large matrices. However, trimfill() and selmodel() won't work with rma.mv objects, even if they are just 'standard' RE models.

I *think* (but would have to double-check very carefully) that selmodel() actually doesn't make use of k*k matrices. If so, you could take the rma.mv results, stuff them into an object that has the structure of a rma.uni object, and then call selmodel() on that object. Not very elegant, but this could be a solution. But trimfill() directly calls rma.uni() for model fitting, so this trick wouldn't work. In principle, one could spin a trimfill() version that avoids calling rma.uni() but this would take some work.

Maybe you could try the 'meta' package and its trimfill() function?

Best,
Wolfgang

> -----Original Message-----
> From: R-sig-meta-analysis <r-sig-meta-analysis-bounces using r-project.org> On Behalf
> Of Yefeng Yang via R-sig-meta-analysis
> Sent: Wednesday, May 22, 2024 11:19
> To: r-sig-meta-analysis using r-project.org
> Cc: Yefeng Yang <yefeng.yang1 using unsw.edu.au>
> Subject: [R-meta] errors returned by rma() and rma.mv() when fitting a large
> dataset
>
> Dear community,
>
> I am trying to test publication bias using trim-and-fill and selection model in
> metafor package. When I ran the RE model with my dataset, it returned my the
> following error:
>
> Error: cannot allocate vector of size 33.8 Gb
>
> I tried both rma() and rma.mv() (the later also can be used to fit RE model).
>
> I think this was caused by the large number of data points in my dataset. My
> dataset contains 67,393 rows (or more precisely, 67,393 paired effect size
> estimates and sampling variance).
>
> Is there any solution workaround that allows me to  fit a RE model with a large
> number of effect sizes, and perform the following trim-and-fill and selection
> model?
>
> Very much appreciate your comments.
>
> Best regards,
> Yefeng

	[[alternative HTML version deleted]]



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