Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R package for Bayesian meta-analysis models, using Stan

License

NotificationsYou must be signed in to change notification settings

wwiecek/baggr

Repository files navigation

CRAN_Status_BadgeCodecov_test_coverageR-CMD-check

This isbaggr, anR package for Bayesianmeta-analysis usingStan.Baggr is intended tobe user-friendly and transparent so that it’s easier to understand themodels you are building and criticise them.

Baggr provides a suite of models that work with both summary data andfull data sets, to synthesise evidence collected from different groups,contexts or time periods. Thebaggr() command automatically detectsthe data type and, by default, fits a partial pooling model (which youmay know asrandom effectsmodels)with weakly informative priors by callingStanto carry out Bayesian inference. Modelling of variances or quantiles,standardisation and transformation of data is also possible.

The current version is a stable version of a tool that’s in activedevelopment so we are counting on your feedback.

Installation

Before starting, please followthe installation instructions forRStan,which is responsible for Bayesian inference inbaggr. If you don’thave Stan, it’s worth following the instructions step-by-step.

The package itself is available on CRAN:

install.packages("baggr")

You can also install the most up-to-date version ofbaggr directlyfrom GitHub; this is what we recommend, but to do that you will need theremotes package:

#installation this way may take 5-15 minutesremotes::install_github("wwiecek/baggr",ref="devel",#if problems try changing to ref = "master"build_vignettes=TRUE,quiet=TRUE,build_opts= c("--no-resave-data","--no-manual"))

Most common issue in installingbaggr is with updating other packages.Try updating your packages (and ensure R is at least version 4) beforetrying theremotes command.

Basic use case

baggr is designed to work well with both individual-level (“full”) andaggregate/summary (“group”) data on treatment effect. In basic cases,only the summary information on treatment effects (such as means andtheir standard errors) is needed. Data are always specified in a singleinput data frame and the samebaggr() function is used for differentmodels.

For the “standard” cases of modelling means, the appropriate model isdetected from the shape of data.

library(baggr)df_pooled<-data.frame("tau"= c(28,8,-3,7,-1,1,18,12),"se"= c(15,10,16,11,9,11,10,18))bg<- baggr(df_pooled,pooling="partial")

You can specify the model type from several choices, the pooling type("none","partial" or"full"), and certain aspects of the priors,as well as other options for data preparation, prediction and more. Youcan access the underlyingstanfit object throughbg$fit.

Flexible plotting methods are included, together with an automaticcomparison of multiple models (e.g. comparing no, partial and fullpooling) throughbaggr_compare() command. Various statistics can becalculated: in particular,pooling() for pooling metrics andloocv()for leave-one-group-out cross-validation, allowing us to then compareand select models vialoo_compare(). Forest plots and plots oftreatment effects are available.

Tryvignette('baggr') for an overview of these functions and anexample of meta-analysis workflow withbaggr. If working with binarydata, tryvignette("baggr_binary"). Compiled vignettes are availableon CRAN.

Current and future releases

Included in baggr v0.7 (2023):

  • Meta-analysis of continuous and binary outcomes
  • Both full and aggregate data sets can be used
  • Summaries and plots specific to meta-analysis, typical diagnosticplots
  • Meta-regression / fixed effects modelling
  • Compatibility withrstan andbayesplot features
  • Automatic choice of priors or “plain-text” specification of priors
  • Calculation of pooling/heterogeneity metrics
  • Cross-validation (leave-one-group-out)
  • Prior and posterior predictive distributions

Check [NEWS.md] for more information on recent changes to the package.

About

R package for Bayesian meta-analysis models, using Stan

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp