Hi, I am a student using R for my final year project, with the metafor package being particularly helpful. I have been following the steps laid out in the manual 'Conducting Meta-analysis in R with the Metafor package' (Viechtbauer, 2010) and applying it to my own data of infected Anopheles mosquitoes across Africa.
In particular, I am attempting to apply a mixed-effect model to my data with absolute latitude as a moderator as per the example in the manual. I am able to generate a plot of Relative Risk against absolute latitude without issue, but when I try to add lines in from the predicted values generated I continually get an error: Error in xy.coords(x, y) : 'x' and 'y' lengths differ However, I have used the length function on both my x and y co-ordinates and found no difference in lengths. If anyone could shed some light on this I'd really appreciate it. The code I used can be found below: > mixed<-read.delim("regressiontest.txt") > mixed study year ablat mosq1pos mosq1neg mosq2pos mosq2neg 1 Cano et al. 2006 2 42 237 148 629 2 Kerah - Hinzoumbe et al. 2009 10 103 7260 3 215 3 Konate et al. 1994 13 83 5714 48 3609 4 Mwanzia et al. 2011 4 2 8971 0 100 > dat<-escalc(measure="RR", ai = mosq1pos, bi = mosq1neg, ci = mosq2pos, di = > mosq2neg, data = mixed, append = TRUE) > res<-rma(yi, vi, mods = ablat, data=dat) > predict(res,transf = exp, addx = TRUE) > preds<-predict(res, transf = exp) > wi<-1/sqrt(dat$vi) > size<-0.5 + 3 *(wi-min(wi))/(max(wi)) - min(wi) > plot(dat$ablat, exp(dat$yi), pch = 19, cex = size, xlab = "Absolute > Latitude", ylab = "Relative Risk", las=1, bty = "l", log = "y") > lines(0:15, preds$pred) Many thanks, Charlotte Hewitt [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.