Skip to content

Commit

Permalink
added test for assessDesign function
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyarz committed Jul 24, 2024
1 parent 99401d9 commit 60b9881
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions tests/testthat/test-BMCPMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,59 @@ test_that("base case input throws no error and has correct properties", {
contr = contr_mat
))


sd_tot <- 9.4

dose_levels <- c(0, 2.5, 5, 10, 20)

prior_list <- lapply(dose_levels, function(dose_group) {
RBesT::mixnorm(weak = c(w = 1, m = 0, s = 200), sigma = 10)
})

names(prior_list) <- c("Ctr", paste0("DG_", dose_levels[-1]))

exp <- DoseFinding::guesst(
d = 5,
p = c(0.2),
model = "exponential",
Maxd = max(dose_levels))

emax <- DoseFinding::guesst(
d = 2.5,
p = c(0.9),
model = "emax")

sigemax <- DoseFinding::guesst(
d = c(2.5, 5),
p = c(0.1, 0.6),
model = "sigEmax")

sigemax2 <- DoseFinding::guesst(
d = c(2, 4),
p = c(0.3, 0.8),
model = "sigEmax")

mods <- DoseFinding::Mods(
linear = NULL,
emax = emax,
exponential = exp,
sigEmax = rbind(sigemax, sigemax2),
doses = dose_levels,
maxEff = -3,
placEff = -12.8)

n_patients <- c(60, 80, 80, 80, 80)

expect_no_error(
assessDesign(
n_patients = n_patients,
mods = mods,
prior_list = prior_list,
sd = sd_tot,
n_sim = 10,
reestimate = TRUE
))

})


Expand Down Expand Up @@ -309,8 +362,6 @@ test_that("addSignificance works as intended", {

# Tests for getPostProb ---------------------------------------------------



# Test for getPostProb
test_that("getPostProb works correctly in a simple case", {
# Create a test case
Expand Down

0 comments on commit 60b9881

Please sign in to comment.