tests/testthat/test-gengamma.R

library(Temporal)
library(testthat)

test_that("Check generalized gamma.", {
  skip_on_cran()
  
  # Without censoring.
  withr::with_seed(
    seed = 102,
    {
      data <- GenData(n = 1e3, dist = "gen-gamma", theta = c(1, 1, 1))
      fit <- FitParaSurv(data, dist = "gen-gamma") 
    }
  )
  # Check confidence intervals for all parameters contain 1.
  expect_true(all(fit@Parameters$L <= 1, 1 <= fit@Parameters$U))
  
  # With censoring.
  withr::with_seed(
    seed = 103,
    {
      data <- GenData(n = 1e4, dist = "gen-gamma", theta = c(1, 1, 1), p = 0.2)
      fit <- FitParaSurv(data, dist = "gen-gamma") 
    }
  )
  # Check confidence intervals for all parameters contain 1.
  expect_true(all(fit@Parameters$L <= 1, 1 <= fit@Parameters$U))
  
})

Try the Temporal package in your browser

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

Temporal documentation built on Sept. 24, 2023, 1:06 a.m.