After a regression model has been estimated, it is typical to extract predicted values. But I can't figure out how to do this in metafor::rma(
library(metafor)
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
mods = ~ ablat + year,
data=dat.bcg)
predict(res,
newdata = expand.grid(
year = 1980,
ablat = 30:55
)
)
which returns 13 fitted values (the rows in the data used to estimate the rma
object, rather than the 25 rows in expand.grid(
object.
How can I do out of sample predictions on a new data.frame
?