I have issue combining metafor and boot package. My original meta-analysis model is following and this runs well:
Lu_i<- rma(yi=Hedges_g,vi=Vg, dat=intensive, mods=~Landscape:Contrast-1, method="REML", random=list(~1|Study,~1|id))
I am using “boot” package for obtain confidence intervals. So I run following function for non-parametric bootstrapping:
boot.func <- function(dat, indices) {
res <- try(rma(yi=Hedges_g,vi=Vg, data=intensive, mods=~Landscape:Contrast-1, method="REML",random=list(~1|Study,~1|id),subset=indices), silent=TRUE)
if (is.element("try-error", class(res))) {
NA
} else {
c(coef(res), vcov(res), res$tau2, res$se.tau2^2)
}
}
However, following command gives error message and do not perform full bootstrapping:
res.boot2 <- boot(intensive, boot.func, R=5000)
Error in boot(intensive, boot.func, R = 5000) : number of items to replace is not a multiple of replacement length In addition: There were 50 or more warnings (use warnings() to see the first 50)
Any tips for help? I think, my code should be correct, because it runs with bigger dataset and also for smaller dataset, but unfortunately not for this subgroup analysis, which I need. Actually, the code runs with very small bootstrapping number (maximum R=32), but with bigger number, I get soon error message, although, the code runs a while. Any suggestions?