Skip to content

Commit

Permalink
explicit args
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Jun 5, 2023
1 parent 69cb5d5 commit 47927f5
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 8 deletions.
4 changes: 4 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ Depends:
R (>= 4.0.0)
Imports:
brms,
coda,
dplyr,
emmeans,
MASS,
posterior,
purrr,
rlang,
stats,
tibble,
tidyr,
tidyselect,
trialr,
utils
Suggests:
Expand Down
12 changes: 12 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,27 @@ importFrom(brms,brmsformula)
importFrom(brms,get_prior)
importFrom(brms,prior)
importFrom(brms,unstr)
importFrom(coda,as.mcmc)
importFrom(dplyr,left_join)
importFrom(emmeans,emmeans)
importFrom(posterior,as_draws_df)
importFrom(posterior,mcse_mean)
importFrom(posterior,mcse_median)
importFrom(posterior,mcse_quantile)
importFrom(posterior,mcse_sd)
importFrom(purrr,map2_df)
importFrom(purrr,map_dbl)
importFrom(purrr,map_df)
importFrom(rlang,warn)
importFrom(stats,as.formula)
importFrom(stats,median)
importFrom(stats,model.matrix)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(stats,sd)
importFrom(tibble,tibble)
importFrom(tidyr,expand_grid)
importFrom(tidyselect,any_of)
importFrom(trialr,rlkjcorr)
importFrom(utils,capture.output)
importFrom(utils,globalVariables)
7 changes: 6 additions & 1 deletion R/brm_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
#' doi:10.1177/009286150804200402
#' @family help
#' @importFrom brms brm brmsformula get_prior prior unstr
#' @importFrom coda as.mcmc
#' @importFrom dplyr left_join
#' @importFrom emmeans emmeans
#' @importFrom MASS mvrnorm
#' @importFrom posterior as_draws_df mcse_mean mcse_median mcse_quantile
#' mcse_sd
#' @importFrom purrr map_dbl map_df map2_df
#' @importFrom rlang warn
#' @importFrom stats as.formula model.matrix rnorm runif
#' @importFrom stats as.formula median model.matrix rnorm runif sd
#' @importFrom tibble tibble
#' @importFrom tidyr expand_grid
#' @importFrom tidyselect any_of
#' @importFrom trialr rlkjcorr
#' @importFrom utils capture.output globalVariables
NULL
Expand Down
12 changes: 10 additions & 2 deletions tests/testthat/test-brm_marginal_draws.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
test_that("brm_marginal_draws() on response", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down Expand Up @@ -89,7 +93,11 @@ test_that("brm_marginal_draws() on response", {

test_that("brm_marginal_draws() on change", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down
12 changes: 10 additions & 2 deletions tests/testthat/test-brm_marginal_probabilities.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
test_that("brm_marginal_probabilities() on response", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down Expand Up @@ -63,7 +67,11 @@ test_that("brm_marginal_probabilities() on response", {

test_that("brm_marginal_probabilities() on change and multiple probs", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down
12 changes: 10 additions & 2 deletions tests/testthat/test-brm_marginal_summaries.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
test_that("brm_marginal_summaries() on response", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down Expand Up @@ -121,7 +125,11 @@ test_that("brm_marginal_summaries() on response", {

test_that("brm_marginal_summaries() on change", {
set.seed(0L)
sim <- brm_simulate()
sim <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)
data <- sim$data
data$group <- paste("treatment", data$group)
data$time <- paste("visit", data$time)
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test-brm_model.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
test_that("brm_model() runs", {
set.seed(0L)
data <- brm_simulate()$data
data <- brm_simulate(
n_group = 2L,
n_patient = 100L,
n_time = 4L
)$data
formula <- brm_formula(
response = "response",
group = "group",
Expand Down

0 comments on commit 47927f5

Please sign in to comment.