Skip to content

Commit

Permalink
Fix broken unit test (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc authored Oct 16, 2024
1 parent 02b4ff9 commit 1ac248e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-analyse.R
Original file line number Diff line number Diff line change
Expand Up @@ -397,5 +397,5 @@ test_that("Parallisation works with analyse and produces identical results", {
expect_false(identical(anaobj_d1_t1$results, anaobj_d2_t1$results))
expect_false(identical(anaobj_d1_t1$results, anaobj_d3_t1$results))
expect_false(identical(anaobj_d2_t1$results, anaobj_d3_t1$results))

parallel::stopCluster(cl)
})
20 changes: 10 additions & 10 deletions tests/testthat/test-mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ get_mcmc_sim_dat <- function(n, mcoefs, sigma) {
dplyr::as_tibble() %>%
dplyr::mutate(id = paste0("P", seq_len(n))) %>%
tidyr::gather("visit", "outcome", -id) %>%
dplyr::mutate(visit = factor(.data$visit)) %>%
dplyr::arrange(id, .data$visit) %>%
dplyr::mutate(visit = factor(visit)) %>%
dplyr::arrange(id, visit) %>%
dplyr::left_join(covars, by = "id") %>%
dplyr::mutate(
outcome = .data$outcome +
outcome = outcome +
mcoefs[["int"]] +
mcoefs[["age"]] * .data$age +
mcoefs[["sex"]] * f2n(.data$sex) +
mcoefs[["trtslope"]] * f2n(.data$group) * as.numeric(.data$visit)
mcoefs[["age"]] * age +
mcoefs[["sex"]] * f2n(sex) +
mcoefs[["trtslope"]] * f2n(group) * as.numeric(visit)
) %>%
dplyr::mutate(id = as.factor(id))

Expand All @@ -39,14 +39,14 @@ get_within <- function(x, real) {
colnames(x2) <- paste0("B", seq_len(ncol(x2)))

as_tibble(x2) %>%
tidyr::gather(var, .data$val) %>%
tidyr::gather(var, val) %>%
group_by(var) %>%
summarise(
lci = quantile(.data$val, 0.005),
uci = quantile(.data$val, 0.995)
lci = quantile(val, 0.005),
uci = quantile(val, 0.995)
) %>%
mutate(real = real) %>%
mutate(inside = real >= .data$lci & real <= .data$uci)
mutate(inside = real >= lci & real <= uci)
}

test_extract_draws <- function(draws_extracted, same_cov, n_groups, n_visits) {
Expand Down

0 comments on commit 1ac248e

Please sign in to comment.