Skip to content

Commit

Permalink
lints and spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Jun 5, 2023
1 parent a3c0f66 commit f677ff5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion R/brm_marginal_draws.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ subtract_control <- function(draws, groups, times, control) {
}

name_marginal <- function(group, time) {
sprintf("%s, %s", group , time)
sprintf("%s, %s", group, time)
}

names_group <- function(draws) {
Expand Down
2 changes: 1 addition & 1 deletion R/brm_marginal_probabilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#' @export
#' @family marginals
#' @description Marginal probabilities on the treatment effect for an MMRM.
#' @return A data frame of probabilities of the form
#' @return A tibble of probabilities of the form
#' `Prob(treatment effect > threshold | data)` and/or
#' `Prob(treatment effect < threshold | data)`. It has one row per
#' probability and the following columns:
Expand Down
20 changes: 6 additions & 14 deletions R/brm_marginal_summaries.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
#' @export
#' @family marginals
#' @description Summary statistics of the marginal posterior of an MMRM.
#' @return A data frame with one row per summary statistic and the following
#' @return A tibble with one row per summary statistic and the following
#' columns:
#' * `group`: treatment group.
#' * `time`: discrete time point.
#' * `marginal`: type of marginal distribution. If `outcome` was `"response"`
#' in [brm_marginal_draws()], then possible values include
#' `"response"` for the response on the raw scale, `"change"` for
#' change from baseline, and `"difference"` for treatment difference
#' in terms of change from baseline. If `outcome` was `"change"`,
#' then possible values include `"response"` for the respons one the
#' then possible values include `"response"` for the response one the
#' change from baseline scale and `"difference"` for treatment difference.
#' * `group`: treatment group.
#' * `time`: discrete time point.
#' * `statistic`: type of summary statistic.
#' * `value`: numeric value of the estimate.
#' * `mcse`: Monte Carlo standard error of the estimate.
Expand Down Expand Up @@ -74,26 +74,18 @@ brm_marginal_summaries <- function(
NULL
)
table_difference <- summarize_marginals(draws$difference, level)
out <- dplyr::bind_rows(
dplyr::bind_rows(
response = table_response,
change = table_change,
difference = table_difference,
.id = "marginal"
)
columns <- c("marginal", "statistic", "group", "time", "value", "mcse")
out <- out[, columns]
args <- lapply(columns, as.symbol)
args$.data <- out
do.call(what = dplyr::arrange, args = args)
}

summarize_marginals <- function(draws, level) {
draws <- tibble::as_tibble(draws)
for (name in names_mcmc) {
draws[[name]] <- NULL
}
level_lower <- (1 - level) / 2
level_upper <- 1 - level_lower
draws[names_mcmc] <- NULL
value <- tibble::tibble(
group = names_group(draws),
time = names_time(draws),
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ Schnell
TBD
Ther
LKJ
AVAL
tibble
2 changes: 1 addition & 1 deletion man/brm_marginal_probabilities.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/brm_marginal_summaries.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/testthat/test-brm_marginal_probabilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ test_that("brm_marginal_probabilities() on change and multiple probs", {
x$value[4L],
mean(draws$difference[["treatment 2, visit 4"]] > -1.7)
)

expect_equal(
x$value[5L],
mean(draws$difference[["treatment 2, visit 1"]] < -1.55)
Expand Down

0 comments on commit f677ff5

Please sign in to comment.