{"id":14068326,"url":"https://github.com/wviechtb/metafor","last_synced_at":"2025-05-15T03:08:41.863Z","repository":{"id":37431533,"uuid":"47127383","full_name":"wviechtb/metafor","owner":"wviechtb","description":"A meta-analysis package for R","archived":false,"fork":false,"pushed_at":"2025-05-08T11:00:51.000Z","size":178550,"stargazers_count":252,"open_issues_count":10,"forks_count":52,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-12T12:11:29.352Z","etag":null,"topics":["meta-analysis","mixed-effects","multilevel-models","multivariate","r","r-package"],"latest_commit_sha":null,"homepage":"https://www.metafor-project.org","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wviechtb.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-11-30T15:21:55.000Z","updated_at":"2025-05-08T11:00:55.000Z","dependencies_parsed_at":"2024-01-12T22:50:16.759Z","dependency_job_id":"c80ce30c-ea34-4992-ba09-580349b96018","html_url":"https://github.com/wviechtb/metafor","commit_stats":{"total_commits":1075,"total_committers":6,"mean_commits":"179.16666666666666","dds":0.01023255813953483,"last_synced_commit":"0cd002abde8eafbbfb1dab8dc5ce143288c8423e"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wviechtb%2Fmetafor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wviechtb%2Fmetafor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wviechtb%2Fmetafor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wviechtb%2Fmetafor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wviechtb","download_url":"https://codeload.github.com/wviechtb/metafor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254264771,"owners_count":22041794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["meta-analysis","mixed-effects","multilevel-models","multivariate","r","r-package"],"created_at":"2024-08-13T07:06:05.942Z","updated_at":"2025-05-15T03:08:36.847Z","avatar_url":"https://github.com/wviechtb.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"metafor: A Meta-Analysis Package for R\n======================================\n\n[![License: GPL (\u003e=2)](https://img.shields.io/badge/license-GPL-blue)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)\n[![R build status](https://github.com/wviechtb/metafor/workflows/R-CMD-check/badge.svg)](https://github.com/wviechtb/metafor/actions)\n[![Code Coverage](https://codecov.io/gh/wviechtb/metafor/branch/master/graph/badge.svg)](https://app.codecov.io/gh/wviechtb/metafor)\n[![CRAN Version](https://www.r-pkg.org/badges/version/metafor)](https://cran.r-project.org/package=metafor)\n[![devel Version](https://img.shields.io/badge/devel-4.9--4-brightgreen.svg)](https://www.metafor-project.org/doku.php/installation#development_version)\n[![Monthly Downloads](https://cranlogs.r-pkg.org/badges/metafor)](https://cranlogs.r-pkg.org/badges/metafor)\n[![Total Downloads](https://cranlogs.r-pkg.org/badges/grand-total/metafor)](https://cranlogs.r-pkg.org/badges/grand-total/metafor)\n\n## Description\n\nThe `metafor` package is a comprehensive collection of functions for conducting meta-analyses in R. The package includes functions to calculate various effect sizes or outcome measures, fit equal-, fixed-, random-, and mixed-effects models to such data, carry out moderator and meta-regression analyses, and create various types of meta-analytical plots (e.g., forest, funnel, radial, L'Abbé, Baujat, bubble, and GOSH plots). For meta-analyses of binomial and person-time data, the package also provides functions that implement specialized methods, including the Mantel-Haenszel method, Peto's method, and a variety of suitable generalized linear (mixed-effects) models (i.e., mixed-effects logistic and Poisson regression models). Finally, the package provides functionality for fitting meta-analytic multivariate/multilevel models that account for non-independent sampling errors and/or true effects (e.g., due to the inclusion of multiple treatment studies, multiple endpoints, or other forms of clustering). Network meta-analyses and meta-analyses accounting for known correlation structures (e.g., due to phylogenetic relatedness) can also be conducted.\n\n## Package Website\n\nThe `metafor` package website can be found at [https://www.metafor-project.org](https://www.metafor-project.org). On the website, you can find:\n\n* some [news](https://www.metafor-project.org/doku.php/news:news) concerning the package and/or its development,\n* a more detailed description of the [package features](https://www.metafor-project.org/doku.php/features),\n* a log of the [package updates](https://www.metafor-project.org/doku.php/updates) that have been made over the years,\n* a [to-do list](https://www.metafor-project.org/doku.php/todo) and a description of planned features to be implemented in the future,\n* information on how to [download and install](https://www.metafor-project.org/doku.php/installation) the package,\n* information on how to obtain [documentation and help](https://www.metafor-project.org/doku.php/help) with using the package,\n* some [analysis examples](https://www.metafor-project.org/doku.php/analyses) that illustrate various models, methods, and techniques,\n* a little showcase of [plots and figures](https://www.metafor-project.org/doku.php/plots) that can be created with the package,\n* some [tips and notes](https://www.metafor-project.org/doku.php/tips) that may be useful when working with the package,\n* a list of people that have in some shape or form [contributed](https://www.metafor-project.org/doku.php/contributors) to the development of the package,\n* a [frequently asked questions](https://www.metafor-project.org/doku.php/faq) section, and\n* some [links](https://www.metafor-project.org/doku.php/links) to other websites related to software for meta-analysis.\n\n## Documentation\n\nA good starting place for those interested in using the `metafor` package is the following paper:\n\nViechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. *Journal of Statistical Software, 36*(3), 1-48. [https://doi.org/10.18637/jss.v036.i03](https://doi.org/10.18637/jss.v036.i03)\n\nIn addition to reading the paper, carefully read the [package intro](https://wviechtb.github.io/metafor/reference/metafor-package.html) and then the help pages for the [`escalc`](https://wviechtb.github.io/metafor/reference/escalc.html) and the [`rma.uni`](https://wviechtb.github.io/metafor/reference/rma.uni.html) functions (or the [`rma.mh`](https://wviechtb.github.io/metafor/reference/rma.mh.html), [`rma.peto`](https://wviechtb.github.io/metafor/reference/rma.peto.html), [`rma.glmm`](https://wviechtb.github.io/metafor/reference/rma.glmm.html), [`rma.mv`](https://wviechtb.github.io/metafor/reference/rma.mv.html) functions if you intend to use these methods). The help pages for these functions provide links to many additional functions, which can be used after fitting a model. You can also read the entire documentation online at [https://wviechtb.github.io/metafor/](https://wviechtb.github.io/metafor/) (where it is nicely formatted, equations are shown correctly, and the output from all examples is provided).\n\nNote that the documentation provided at [https://wviechtb.github.io/metafor/](https://wviechtb.github.io/metafor/) is based on the development version of the package (see below). Therefore, if an example from the documentation does not work as intended, try out the development version first.\n\n## Installation\n\nThe current official (i.e., [CRAN](https://cran.r-project.org/package=metafor)) release can be installed within R with:\n```r\ninstall.packages(\"metafor\")\n```\n\nThe development version of the package can be installed with:\n```r\ninstall.packages(\"remotes\")\nremotes::install_github(\"wviechtb/metafor\")\n```\nThis builds the package from source based on the current version on [GitHub](https://github.com/wviechtb/metafor).\n\n## Example\n\n```r\n# load metafor package\nlibrary(metafor)\n\n# examine the BCG vaccine dataset\ndat.bcg\n```\n\n```\n##    trial               author year tpos  tneg cpos  cneg ablat      alloc\n## 1      1              Aronson 1948    4   119   11   128    44     random\n## 2      2     Ferguson \u0026 Simes 1949    6   300   29   274    55     random\n## 3      3      Rosenthal et al 1960    3   228   11   209    42     random\n## 4      4    Hart \u0026 Sutherland 1977   62 13536  248 12619    52     random\n## 5      5 Frimodt-Moller et al 1973   33  5036   47  5761    13  alternate\n## 6      6      Stein \u0026 Aronson 1953  180  1361  372  1079    44  alternate\n## 7      7     Vandiviere et al 1973    8  2537   10   619    19     random\n## 8      8           TPT Madras 1980  505 87886  499 87892    13     random\n## 9      9     Coetzee \u0026 Berjak 1968   29  7470   45  7232    27     random\n## 10    10      Rosenthal et al 1961   17  1699   65  1600    42 systematic\n## 11    11       Comstock et al 1974  186 50448  141 27197    18 systematic\n## 12    12   Comstock \u0026 Webster 1969    5  2493    3  2338    33 systematic\n## 13    13       Comstock et al 1976   27 16886   29 17825    33 systematic\n```\n\n```r\n# tpos  - number of TB positive cases in the treated (vaccinated) group\n# tneg  - number of TB negative cases in the treated (vaccinated) group\n# cpos  - number of TB positive cases in the control (non-vaccinated) group\n# cneg  - number of TB negative cases in the control (non-vaccinated) group\n#\n# these variables denote the values in 2x2 tables of the form:\n#\n#           TB+    TB-\n#         +------+------+\n# treated | tpos | tneg |\n#         +------+------+\n# control | cpos | cneg |\n#         +------+------+\n#\n# year  - publication year of the study\n# ablat - absolute latitude of the study location (in degrees)\n# alloc - method of treatment allocation (random, alternate, or systematic assignment)\n\n# calculate log risk ratios and corresponding sampling variances for the BCG vaccine dataset\ndat \u003c- escalc(measure=\"RR\", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,\n              slab=paste(author, year, sep=\", \")) # also add study labels\ndat\n```\n\n```\n##    trial               author year tpos  tneg cpos  cneg ablat      alloc      yi     vi\n## 1      1              Aronson 1948    4   119   11   128    44     random -0.8893 0.3256\n## 2      2     Ferguson \u0026 Simes 1949    6   300   29   274    55     random -1.5854 0.1946\n## 3      3      Rosenthal et al 1960    3   228   11   209    42     random -1.3481 0.4154\n## 4      4    Hart \u0026 Sutherland 1977   62 13536  248 12619    52     random -1.4416 0.0200\n## 5      5 Frimodt-Moller et al 1973   33  5036   47  5761    13  alternate -0.2175 0.0512\n## 6      6      Stein \u0026 Aronson 1953  180  1361  372  1079    44  alternate -0.7861 0.0069\n## 7      7     Vandiviere et al 1973    8  2537   10   619    19     random -1.6209 0.2230\n## 8      8           TPT Madras 1980  505 87886  499 87892    13     random  0.0120 0.0040\n## 9      9     Coetzee \u0026 Berjak 1968   29  7470   45  7232    27     random -0.4694 0.0564\n## 10    10      Rosenthal et al 1961   17  1699   65  1600    42 systematic -1.3713 0.0730\n## 11    11       Comstock et al 1974  186 50448  141 27197    18 systematic -0.3394 0.0124\n## 12    12   Comstock \u0026 Webster 1969    5  2493    3  2338    33 systematic  0.4459 0.5325\n## 13    13       Comstock et al 1976   27 16886   29 17825    33 systematic -0.0173 0.0714\n```\n\n```r\n# fit random-effects model\nres \u003c- rma(yi, vi, data=dat, test=\"knha\")\nres\n```\n\n```\n## Random-Effects Model (k = 13; tau^2 estimator: REML)\n##\n## tau^2 (estimated amount of total heterogeneity): 0.3132 (SE = 0.1664)\n## tau (square root of estimated tau^2 value):      0.5597\n## I^2 (total heterogeneity / total variability):   92.22%\n## H^2 (total variability / sampling variability):  12.86\n##\n## Test for Heterogeneity:\n## Q(df = 12) = 152.2330, p-val \u003c .0001\n##\n## Model Results:\n##\n## estimate      se     tval  df    pval    ci.lb    ci.ub\n##  -0.7145  0.1808  -3.9522  12  0.0019  -1.1084  -0.3206  **\n##\n## ---\n## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n```\n\n```r\n# predicted pooled risk ratio (with 95% confidence/prediction intervals)\npredict(res, transf=exp, digits=2)\n```\n\n```\n## pred ci.lb ci.ub pi.lb pi.ub\n## 0.49  0.33  0.73  0.14  1.76\n```\n\n```r\n# forest plot\nforest(res, atransf=exp, at=log(c(.05, .25, 1, 4)), xlim=c(-16,6),\n       ilab=cbind(tpos, tneg, cpos, cneg), ilab.xpos=c(-9.5,-8,-6,-4.5),\n       header=\"Author(s) and Year\", shade=\"zebra\")\ntext(c(-9.5,-8,-6,-4.5), 15,   c(\"TB+\", \"TB-\", \"TB+\", \"TB-\"), font=2)\ntext(c(-8.75,-5.25),     15.8, c(\"Vaccinated\", \"Control\"),    font=2)\n```\n\n![](man/figures/ex_forest_plot.png)\n\n```r\n# funnel plot\nfunnel(res, ylim=c(0,0.8), las=1)\n```\n\n![](man/figures/ex_funnel_plot.png)\n\n```r\n# regression test for funnel plot asymmetry\nregtest(res)\n```\n\n```\n## Regression Test for Funnel Plot Asymmetry\n##\n## Model:     mixed-effects meta-regression model\n## Predictor: standard error\n##\n## Test for Funnel Plot Asymmetry: t = -0.7812, df = 11, p = 0.4512\n## Limit Estimate (as sei -\u003e 0):   b = -0.5104 (CI: -1.2123, 0.1915)\n```\n\n```r\n# mixed-effects meta-regression model with absolute latitude as moderator\nres \u003c- rma(yi, vi, mods = ~ ablat, data=dat, test=\"knha\")\nres\n```\n\n```\n## Mixed-Effects Model (k = 13; tau^2 estimator: REML)\n##\n## tau^2 (estimated amount of residual heterogeneity):     0.0764 (SE = 0.0591)\n## tau (square root of estimated tau^2 value):             0.2763\n## I^2 (residual heterogeneity / unaccounted variability): 68.39%\n## H^2 (unaccounted variability / sampling variability):   3.16\n## R^2 (amount of heterogeneity accounted for):            75.62%\n##\n## Test for Residual Heterogeneity:\n## QE(df = 11) = 30.7331, p-val = 0.0012\n##\n## Test of Moderators (coefficient 2):\n## F(df1 = 1, df2 = 11) = 12.5905, p-val = 0.0046\n##\n## Model Results:\n##\n##          estimate      se     tval  df    pval    ci.lb    ci.ub\n## intrcpt    0.2515  0.2839   0.8857  11  0.3948  -0.3735   0.8764\n## ablat     -0.0291  0.0082  -3.5483  11  0.0046  -0.0472  -0.0111  **\n##\n## ---\n## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n```\n\n```r\n# bubble plot (with points outside of the prediction interval labeled)\nregplot(res, mod=\"ablat\", pi=TRUE, xlab=\"Absolute Latitude\",\n        xlim=c(0,60), predlim=c(0,60), transf=exp, refline=1, legend=TRUE,\n        label=\"piout\", labsize=0.9, bty=\"l\", las=1, digits=1)\n```\n\n![](man/figures/ex_bubble_plot.png)\n\n## Meta\n\nThe metafor package was written by [Wolfgang Viechtbauer](https://www.wvbauer.com/). It is licensed under the [GNU General Public License](https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt). For citation info, type `citation(package='metafor')` in R. To report any issues or bugs or to suggest enhancements to the package, please go [here](https://github.com/wviechtb/metafor/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwviechtb%2Fmetafor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwviechtb%2Fmetafor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwviechtb%2Fmetafor/lists"}