dreamer

An R package to fit Bayesian model averaging of (possibly longitudinal) dose-response models.

https://github.com/rich-payne/dreamer

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.4%) to scientific vocabulary

Keywords

bayesian dose-response-modeling r-package
Last synced: 6 months ago · JSON representation

Repository

An R package to fit Bayesian model averaging of (possibly longitudinal) dose-response models.

Basic Info
Statistics
  • Stars: 9
  • Watchers: 3
  • Forks: 2
  • Open Issues: 3
  • Releases: 2
Topics
bayesian dose-response-modeling r-package
Created over 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
editor_options: 
  chunk_output_type: console
---


[![R-CMD-check](https://github.com/rich-payne/dreamer/actions/workflows/check.yaml/badge.svg)](https://github.com/rich-payne/dreamer/actions/workflows/check.yaml)
[![cover](https://github.com/rich-payne/dreamer/actions/workflows/cover.yaml/badge.svg)](https://github.com/rich-payne/dreamer/actions/workflows/cover.yaml)
[![lint](https://github.com/rich-payne/dreamer/actions/workflows/lint.yaml/badge.svg)](https://github.com/rich-payne/dreamer/actions/workflows/lint.yaml)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/dreamer?color=brightgreen)](https://r-pkg.org/pkg/dreamer)
[![CRAN Release](https://www.r-pkg.org/badges/version/dreamer)](https://r-pkg.org/pkg/dreamer)


```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```
# dreamer 

The goal of dreamer (Dose REsponse bAyesian Model avERaging) is to flexibly model (longitudinal) dose-response relationships.  This is accomplished using Bayesian model averaging of parametric dose-response models (see Gould (2019), Ando & Tsay (2010)).

dreamer supports a number of dose-response models including linear, quadratic, 
log-linear, log-quadratic, EMAX, exponential, for use as models that
can be included in the model averaging approach.  In addition, several
longitudinal models are also supported (see the vignette).  All of the above
models are available for both continuous and binary endpoints.

# Installation

dreamer is available on CRAN and can be installed with `install.packages("dreamer")`.  Note that dreamer depends on [rjags](https://cran.r-project.org/package=rjags) which
itself depends on an installation of JAGS.

The development version of dreamer can be installed directly from github: 
`devtools::install_github("rich-payne/dreamer")`.

For feature requests and to report bugs, please submit an issue to the [dreamer github](https://github.com/rich-payne/dreamer/issues).

# Vignettes

See the "dreamer_method" vignette for a high-level overview of Bayesian model averaging and/or read Gould (2019) for the approach used by dreamer.

For a larger set of examples, see the "dreamer" vignette.

# Example

With dreamer, it is easy to generate data, fit models, and visualize model
fits.

```{r example}
library(dreamer)
# generate data from a quadratic dose response
set.seed(888)
data <- dreamer_data_quad(
  n_cohorts = c(10, 10, 10, 10), # number of subjects in each cohort
  dose = c(.25, .5, .75, 1.5), # dose administered to each cohort
  b1 = 0,
  b2 = 2,
  b3 = -1,
  sigma = .5 # standard deviation
)

# Bayesian model averaging
output <- dreamer_mcmc(
  data = data,
  # mcmc information
  n_adapt = 1e3,
  n_burn = 1e3,
  n_iter = 1e4,
  n_chains = 2,
  silent = TRUE, # make rjags be quiet
  # model definitions
  mod_linear = model_linear(
    mu_b1 = 0,
    sigma_b1 = 1,
    mu_b2 = 0,
    sigma_b2 = 1,
    shape = 1,
    rate = .001,
    w_prior = 1 / 3 # prior probability of the model
  ),
  mod_quad = model_quad(
    mu_b1 = 0,
    sigma_b1 = 1,
    mu_b2 = 0,
    sigma_b2 = 1,
    mu_b3 = 0,
    sigma_b3 = 1,
    shape = 1,
    rate = .001,
    w_prior = 1 / 3
  ),
  mod_emax = model_emax(
    mu_b1 = 0,
    sigma_b1 = 1,
    mu_b2 = 0,
    sigma_b2 = 1,
    mu_b3 = 0,
    sigma_b3 = 1,
    mu_b4 = 0,
    sigma_b4 = 1,
    shape = 1,
    rate = .001,
    w_prior = 1 / 3
  )
)

output

# plot Bayesian model averaging fit
plot(output, data = data)

# plot individual model fit
plot(output$mod_emax, data = data)

# posterior summary for model parameters
summary(output)

# posterior summary on dose-response curve
posterior(output)
```

## Reference

Ando, T., & Tsay, R. (2010). Predictive likelihood for Bayesian model selection and averaging. International Journal of Forecasting, 26(4), 744-763.

Gould, A. Lawrence. "BMA‐Mod: A Bayesian model averaging strategy for determining dose‐response relationships in the presence of model uncertainty." *Biometrical Journal* 61.5 (2019): 1141-1159.

Owner

  • Name: Richard Payne
  • Login: rich-payne
  • Kind: user
  • Company: @EliLillyCo

Statistician specializing in Bayesian methods and R-package development.

GitHub Events

Total
  • Create event: 6
  • Release event: 1
  • Issues event: 9
  • Watch event: 1
  • Delete event: 3
  • Issue comment event: 2
  • Push event: 18
  • Pull request event: 9
  • Fork event: 1
Last Year
  • Create event: 6
  • Release event: 1
  • Issues event: 9
  • Watch event: 1
  • Delete event: 3
  • Issue comment event: 2
  • Push event: 18
  • Pull request event: 9
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 113
  • Total Committers: 2
  • Avg Commits per committer: 56.5
  • Development Distribution Score (DDS): 0.062
Past Year
  • Commits: 14
  • Committers: 2
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.071
Top Committers
Name Email Commits
Richard Payne r****e@l****m 106
Richard Payne 3****e 7
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 29
  • Total pull requests: 28
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 18 days
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 0.41
  • Average comments per pull request: 0.21
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 5
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 4 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rich-payne (26)
  • wlandau (2)
  • mitchell-thomann (1)
Pull Request Authors
  • rich-payne (29)
  • mitchell-thomann (5)
  • olivroy (2)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 302 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: dreamer

Dose Response Models for Bayesian Model Averaging

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 302 Last month
Rankings
Stargazers count: 26.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 35.5%
Downloads: 57.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • coda * imports
  • dplyr >= 1.0.0 imports
  • ellipsis >= 0.3 imports
  • ggplot2 * imports
  • graphics * imports
  • purrr * imports
  • rjags >= 4 imports
  • rlang >= 0.4.5 imports
  • rootSolve * imports
  • stats * imports
  • tidyr >= 1.0.2 imports
  • tidyselect >= 1.1 imports
  • fs >= 1.5 suggests
  • knitr * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 3.0 suggests
  • tibble * suggests
.github/workflows/check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/cover.yaml actions
  • actions/cache v2 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lint.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite