Skip to content

[R-meta] metafor applicable for non-linear associations?

2 messages · Wolf, Katrin, Viechtbauer Wolfgang (STAT)

#
Dear all,

Is it possible to apply metafor for non-linear associations? Is there any literature on how doing so? I really appreciate any comments, suggestions...

Best,
katrin
-----------------------------------------------------------------
Dipl.-Psych. Katrin M. Wolf
Freie Universit?t Berlin
Fachbereich Erziehungswissenschaft und Psychologie
Arbeitsbereich Fr?hkindliche Bildung und Erziehung
Habelschwerdter Allee 45
14195 Berlin
Telefon: 030 - 838 63922
Raum: KL 23/222c
#
Dear Katrin,

Do you mean the non-linear association between two variables within each study or do you mean the non-linear association in the context of meta-regression (i.e., between some outcome/effect size and one or more predictor variables)?

The former would require that some measure of the non-linear association is reported by each study. Those estimates (with corresponding SEs/variances) can then be used as input into rma().

For the latter, it depends on how you want to model the non-linear association. Polynomials (quadratic, cubic, etc.) can be easily included as predictor/moderator variables. Cubic splines can also be used for this purpose (the 'rms' package provides useful functions for this). Here is an example:

library(metafor)

### load data
dat <- get(data(dat.raudenbush1985, package="metafor"))

### plot data
with(dat, plot(weeks, yi, pch=19, xlab="Weeks", ylab="Standardized Mean Difference"))
xs <- seq(0,25,by=1)

### linear and quadratic models
res <- rma(yi ~ weeks, vi, data=dat)
lines(xs, predict(res, newmods=xs)$pred, lwd=2)
res <- rma(yi ~ weeks + I(weeks^2), vi, data=dat)
lines(xs, predict(res, newmods=cbind(xs,xs^2))$pred, col="blue", lwd=2)

### model with restricted cubic spline
library(rms)
knots <- c(1,2,5,10)
res <- rma(yi ~ rcs(weeks,knots), vi, data=dat)
points(dat$weeks, fitted(res))
lines(xs, predict(res, newmods=rcspline.eval(xs, knots, inclx=TRUE))$pred, col="red", lwd=2)

### end example

If you want a truly non-linear model, then the answer is no, metafor does not provide functionality for that.

Best,
Wolfgang