Nothing
test_that("format", {
data("CFAdata")
D <- subset.data.frame(
x = CFAdata,
subset = cell.line == levels(CFAdata$cell.line)[1]
)
fit.0 <- pwr_reg(seeded = D$`Cells seeded`, D$`0 Gy`)
fit.4 <- pwr_reg(seeded = D$`Cells seeded`, D$`4 Gy`)
expect_error(calculate_sf(
par_ref = fit.0,
par_treat = as.data.frame(fit.4$coefficients[, 1])
))
expect_error(calculate_sf(
par_ref = fit.0,
par_treat = matrix(fit.4$coefficients[, 1],
ncol = 2
)
))
expect_error(
calculate_sf(
par_ref = matrix(
data = fit.0$coefficients[, 1],
ncol = 2
),
par_treat = matrix(
data = rep(fit.4$coefficients[, 1], times = 3),
ncol = 2
)
)
)
expect_equal(
length(
calculate_sf(
par_ref = matrix(data = c(2, 1, 2, 1, 4, 3), ncol = 2, byrow = TRUE),
par_treat = matrix(data = c(3, 2, 3, 2, 7, 6), ncol = 2, byrow = TRUE),
C = 20
)
),
3
)
})
test_that("robust calculation", {
data("CFAdata")
D <- subset.data.frame(
x = CFAdata,
subset = cell.line == levels(CFAdata$cell.line)[1]
)
fit.0 <- pwr_reg(seeded = D$`Cells seeded`, D$`0 Gy`)
fit.4 <- pwr_reg(seeded = D$`Cells seeded`, D$`4 Gy`)
expect_equal(
calculate_sf(par_ref = fit.0, par_treat = fit.4),
calculate_sf(
par_ref = matrix(
data = fit.0$coefficients[, 1],
ncol = 2
),
par_treat = matrix(
data = fit.4$coefficients[, 1],
ncol = 2
)
)
)
fit.0$coefficients[2, 1] <- 0
exp_out <- Inf
names(exp_out) <- 20
expect_equal(calculate_sf(par_ref = fit.0, par_treat = fit.4), exp_out)
})
test_that("correct calculation", {
data("CFAdata")
D <- subset.data.frame(
x = CFAdata,
subset = cell.line == levels(CFAdata$cell.line)[1]
)
fit.0 <- pwr_reg(seeded = D$`Cells seeded`, D$`0 Gy`)
fit.4 <- pwr_reg(seeded = D$`Cells seeded`, D$`4 Gy`)
exp_out <- 1
names(exp_out) <- 20
expect_equal(
calculate_sf(
par_ref = matrix(data = fit.0$coefficients[, 1], ncol = 2),
par_treat = matrix(data = fit.0$coefficients[, 1], ncol = 2)
),
exp_out
)
expect_equal(
calculate_sf(
par_ref = matrix(data = c(2, 1, 2, 1), ncol = 2, byrow = TRUE),
par_treat = matrix(data = c(3, 2, 3, 2), ncol = 2, byrow = TRUE),
C = 50
),
rep(exp((log(50) - 2) / 1 - (log(50) - 3) / 2), 2)
)
})
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.