tests/testthat/test-residuals.R

test_that("residuals_frailty calculates residuals and goodness of fit", {
  set.seed(123)
  dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8))
  fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma")

  res <- residuals_frailty(fit)
  expect_equal(length(res$cox_snell), 60)
  expect_equal(length(res$martingale), 60)
  expect_equal(length(res$deviance), 60)
  expect_true(is.numeric(res$MSE))
  expect_true(is.numeric(res$KS_pvalue))
})

Try the MultiFrailty package in your browser

Any scripts or data that you put into this service are public.

MultiFrailty documentation built on Aug. 8, 2026, 1:07 a.m.