Nothing
library(Temporal)
library(testthat)
test_that("Check exponential.", {
skip_on_cran()
n <- 1000
# Comparison, same medians.
withr::with_seed(
seed = 102,
{
df1 <- GenData(n = n, dist = "log-normal", theta = c(0, 2), p = 0.2)
df1$arm <- 1
df0 <- GenData(n = n, dist = "weibull", theta = c(2, sqrt(log(2))), p = 0.2)
df0$arm <- 0
data <- rbind(df1, df0)
comp <- CompParaSurv(data, dist1 = "log-normal", dist0 = "weibull")
}
)
# Expect p-values for difference and ratio of medians are not significant.
expect_true(all(comp@Location$P[3:4] > 0.05))
# Comparison, same means.
withr::with_seed(
seed = 103,
{
df1 <- GenData(n = n, dist = "gamma", theta = c(2, 2), p = 0.2)
df1$arm <- 1
df0 <- GenData(n = n, dist = "weibull", theta = c(2, sqrt(pi) / 2), p = 0.2)
df0$arm <- 0
data <- rbind(df1, df0)
comp <- CompParaSurv(data, dist1 = "gamma", dist0 = "weibull")
}
)
# Expect p-values for difference and ratio of means are not significant.
expect_true(all(comp@Location$P[1:2] > 0.05))
# Comparison, same distribution, different censoring levels.
withr::with_seed(
seed = 104,
{
df1 <- GenData(n = n, dist = "weibull", theta = c(2, 2), p = 0.2)
df1$arm <- 1
df0 <- GenData(n = n, dist = "weibull", theta = c(2, 2), p = 0.4)
df0$arm <- 0
data <- rbind(df1, df0)
comp <- CompParaSurv(data, dist1 = "weibull")
}
)
# Expect p-values for difference and ratio of means/medians are not significant.
expect_true(all(comp@Location$P > 0.05))
})
test_that("CompParaSurv with tau returns RMST contrasts.", {
skip_on_cran()
withr::with_seed(
seed = 105,
{
df1 <- GenData(n = 500, dist = "weibull", theta = c(2, 2), p = 0.2)
df1$arm <- 1
df0 <- GenData(n = 500, dist = "weibull", theta = c(2, 2), p = 0.2)
df0$arm <- 0
data <- rbind(df1, df0)
comp <- CompParaSurv(data, dist1 = "weibull", dist0 = "weibull", tau = c(0.5, 1))
}
)
expect_true(nrow(comp@RMST) >= 1)
expect_true("Tau" %in% names(comp@RMST))
expect_true("Point" %in% names(comp@RMST))
})
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.