[R] Trim and fill procedure

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Tue Apr 7 13:07:25 CEST 2015

Yes, a comparison of the two objects would tell you what's been added.

An object returned by the trimfill() function also has a vector added to it, named 'fill', which indicates whether the data (which are stored in the vector 'yi') are observed or augmented values. So, for example:


### load BCG vaccine data

### meta-analysis of the log relative risks using a fixed-effects model
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, method="FE")

### trim and fill analysis
tmp <- trimfill(res)

### show log relative risks and dummy variable to indicate augmented values
data.frame(tmp$yi, tmp$fill)

### that's in fact how the funnel() function knows how to draw the points when you do:


> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Michael
> Dewey
> Sent: Monday, April 06, 2015 14:55
> To: Carlijn Wibbelink; r-help at r-project.org
> Subject: Re: [R] Trim and fill procedure
> Hello Carlijn
> Well the documentation for trimfill says they are added.
> library(metafor)
> example(trimfill)
> This now leaves you with
> res
> res.tf
> By looking at these and seeing which vectors have grown you should be
> able to extract the yi and vi which you want.
> Wolfgang will doubtless be on the list soon to tell us there is a neater
> way of doing this.
> On 04/04/2015 21:27, Carlijn Wibbelink wrote:
> > Hi all,
> >
> > I have a question concerning the trim and fill procedure in metafor. In
> STATA it is possible to obtain the values of the added estimated effect
> sizes. I was wondering if this is also possible in R and if so, how I can
> obtain the new data with the added values.
> > I would really appreciate your response.
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list