Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ SimJointDataResults <- function(

return(
.SimJointData(
survival = os_dat |> dplyr::rename(all_of(original_names)),
survival = os_dat |> dplyr::rename(dplyr::all_of(original_names)),
longitudinal = lm_dat2[, c(
"subject",
"arm",
Expand All @@ -462,7 +462,7 @@ SimJointDataResults <- function(
"sld",
"observed"
)] |>
dplyr::rename(all_of(original_names))
dplyr::rename(dplyr::all_of(original_names))
)
)
}
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/helper-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ is_full_test <- function() {
toupper(Sys.getenv("JMPOST_FULL_TEST")) == "TRUE"
}

activate_full_test <- function() {
Sys.setenv(JMPOST_FULL_TEST = "TRUE")
}

disable_full_test <- function() {
Sys.setenv(JMPOST_FULL_TEST = "FALSE")
}

is_graph_snapshot_enabled <- function() {
toupper(Sys.getenv("JMPOST_GRAPH_SNAPSHOT")) == "TRUE"
}
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-LongitudinalGSF.R
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ test_that("Can recover known distributional parameters from unscaled variance GS
iter_sampling = 800,
chains = 2,
refresh = 200,
parallel_chains = 2
parallel_chains = 2,
seed = 123
)
})
})
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-SurvivalExponential.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ test_that("SurvivalExponential can recover true parameter (including covariates)
beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]),
beta_cont = true_beta[3],
),
longitudinal = SimLongitudinalRandomSlope(slope_mu = 0)
longitudinal = SimLongitudinalRandomSlope(
slope_mu = 0,
slope_sigma = 0.5
)
)

dat_os <- jdat@survival
Expand Down Expand Up @@ -59,7 +62,8 @@ test_that("SurvivalExponential can recover true parameter (including covariates)
iter_warmup = 500,
chains = 1,
refresh = 0,
parallel_chains = 1
parallel_chains = 1,
seed = 123
)
})

Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-SurvivalGamma.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ test_that("SurvivalGamma can recover known values", {
beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]),
beta_cont = true_beta[3],
),
longitudinal = SimLongitudinalRandomSlope(slope_mu = 0),
longitudinal = SimLongitudinalRandomSlope(
slope_mu = 0,
slope_sigma = 0.5
),
.silent = TRUE
)

Expand Down Expand Up @@ -94,7 +97,8 @@ test_that("SurvivalGamma can recover known values", {
iter_sampling = 400,
chains = 2,
refresh = 100,
parallel_chains = 2
parallel_chains = 2,
seed = 123
)
})
})
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-SurvivalLoglogistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ test_that("SurvivalLogLogistic can recover known values", {
beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]),
beta_cont = true_beta[3],
),
longitudinal = SimLongitudinalRandomSlope(slope_mu = 0),
longitudinal = SimLongitudinalRandomSlope(
slope_mu = 0,
slope_sigma = 0.5
),
.silent = TRUE
)

Expand Down Expand Up @@ -77,7 +80,8 @@ test_that("SurvivalLogLogistic can recover known values", {
iter_sampling = 450,
chains = 1,
refresh = 0,
parallel_chains = 1
parallel_chains = 1,
seed = 123
)
})

Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-SurvivalWeibullPH.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ test_that("SurvivalWeibullPH can recover known values", {
beta_cat = c("A" = 0, "B" = true_beta[1], "C" = true_beta[2]),
beta_cont = true_beta[3],
),
longitudinal = SimLongitudinalRandomSlope(slope_mu = 0),
longitudinal = SimLongitudinalRandomSlope(
slope_mu = 0,
slope_sigma = 0.5
),
.silent = TRUE
)

Expand Down Expand Up @@ -84,7 +87,8 @@ test_that("SurvivalWeibullPH can recover known values", {
iter_sampling = 400,
chains = 1,
refresh = 0,
parallel_chains = 1
parallel_chains = 1,
seed = 123
)
})

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ test_that("simulate works with lambda_censor", {
)

joined <- dplyr::left_join(
results@survival[, c("subject", "time", "event")],
results@longitudinal[, c("subject", "time", "observed")],
by = "subject"
results@survival[, c("id", "time", "event")],
results@longitudinal[, c("id", "time", "observed")],
by = "id"
)

expect_true(all(!joined$observed[joined$time.y > joined$time.x]))
Expand Down
Loading