[R-meta] metafor applicable for non-linear associations?
katrin.wolf2 at fu-berlin.de
Thu Feb 1 14:09:43 CET 2018
Thank you very much for your immediate response!
I'm not sure if I get the difference between the alternatives you mentioned. We expect a non-linear/quadratic association between two variables (effects of duration in early childcare on social-emotional outcomes) and will include all studies that reported results on that association. So is it about a (1) non-linear association between two variables within each study or (2) non-linear association between some outcome and one or more predictor? (I guess the latter)
Thank you very much for your information on rms and its graphic functions - that is very helpful!
Date: Tue, 30 Jan 2018 10:42:49 +0000
From: "Viechtbauer Wolfgang (SP)"
<wolfgang.viechtbauer at maastrichtuniversity.nl>
To: "Wolf, Katrin" <katrin.wolf2 at fu-berlin.de>,
"r-sig-meta-analysis at r-project.org"
<r-sig-meta-analysis at r-project.org>
Subject: Re: [R-meta] metafor applicable for non-linear associations?
Message-ID: <4d9263e0576645669d4795cc412ae8dc at UM-MAIL3214.unimaas.nl>
Content-Type: text/plain; charset="utf-8"
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:
### 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
knots <- c(1,2,5,10)
res <- rma(yi ~ rcs(weeks,knots), vi, data=dat)
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.
>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?
>Is it possible to apply metafor for non-linear associations? Is there any
>literature on how doing so? I really appreciate any comments,
>Dipl.-Psych. Katrin M. Wolf
>Freie Universit?t Berlin
>Fachbereich Erziehungswissenschaft und Psychologie
>Arbeitsbereich Fr?hkindliche Bildung und Erziehung
>Habelschwerdter Allee 45
>Telefon: 030 - 838 63922
>Raum: KL 23/222c
More information about the R-sig-meta-analysis