Skip to content
Prev 319893 / 398502 Next

Error when adding lines to a plot using the mixed-effect model and metafor package

See comments below.

Best,
Wolfgang

--   
Wolfgang Viechtbauer, Ph.D., Statistician   
Department of Psychiatry and Psychology   
School for Mental Health and Neuroscience   
Faculty of Health, Medicine, and Life Sciences   
Maastricht University, P.O. Box 616 (VIJV1)   
6200 MD Maastricht, The Netherlands   
+31 (43) 388-4170 | http://www.wvbauer.com
So there are 4 studies in your dataset.
This will save the predicted values *for those 4 studies* in "preds".
So you are trying to plot a line based on 16 x-values (0:15) and the 4 y-values in preds. That can't work. If you want to obtain the predicted values for ablat values equal to 0:15, then you need to do:

preds <- predict(res, newmods=0:15, transf=exp)

And then the code should work.