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

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Tue Jan 30 11:42:49 CET 2018

```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

>-----Original Message-----
>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
>project.org] On Behalf Of Wolf, Katrin
>Sent: Tuesday, 30 January, 2018 11:29
>To: r-sig-meta-analysis at r-project.org
>Subject: [R-meta] metafor applicable for non-linear associations?
>
>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
```

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