Nothing
test_that("outcome must be Surv object", {
expect_error(
survival_ln_mixture(y ~ x, sim_data$data)
)
})
test_that("only right censored data supported", {
expect_error(
survival_ln_mixture(survival::Surv(y, delta, type = "left") ~ x, sim_data$data)
)
})
test_that("events at time zero are not supported", {
data_new <- sim_data$data
data_new$y[1] <- 0
expect_error(
survival_ln_mixture(survival::Surv(y, delta, type = "left") ~ x, sim_data$data)
)
})
test_that("when using ~NULL, intercept must be TRUE", {
expect_error(
survival_ln_mixture(survival::Surv(y, delta) ~ NULL, sim_data$data, intercept = FALSE)
)
})
test_that("survival_ln_mixture doesnt work with xy specification", {
expect_error(
survival_ln_mixture(sim_data$data$y, sim_data$data$x)
)
})
test_that("survival_ln_mixture works with intercept only fit", {
mod <- readRDS(test_path("fixtures", "ln_fit_with_intercept_only.rds"))
expect_equal(tidy(mod)$estimate, c(3.44, 4.02, 4.83), tolerance = 1)
})
test_that("fit works as expected with simulated data", {
mod <- readRDS(test_path("fixtures", "ln_fit_with_covariates.rds"))
post_summary <- posterior::summarise_draws(mod$posterior, estimate = stats::median, std.error = stats::mad)
colnames(post_summary)[1] <- "term"
post_tidy <- tidy(mod, effects = c("fixed", "auxiliary"))
expected_result <- structure(
list(term = c(
"(Intercept)_1", "x1_1", "(Intercept)_2",
"x1_2", "phi_1", "phi_2", "eta_1"
), estimate = c(
4.05, 0.81, 3.43, 0.487, 26.7, 3.18, 0.505
), std.error = c(
0.00668, 0.00942, 0.0172, 0.0203, 1.34, 0.114, 0.0109
)),
row.names = c(NA, -7L),
class = c("draws_summary", "tbl_df", "tbl", "data.frame"),
num_args = list())
expect_equal(mod$nobs, 10000)
expect_equal(post_summary, post_tidy, tolerance = 1)
expect_equal(post_summary, expected_result, tolerance = 1)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.