test_that("impute_root", {
data <- data.frame(n = c(1, 1, 5),
n_pos = c(1, 0, 3),
freq = c(10, 2, 4))
out <- impute_root(data, prob_pos = 1,
B = 1)
expect_equal(as.numeric(out[1,-c(1:2)]), c(2, 2, 10))
expect_equal(as.numeric(out[2,-c(1:2)]), c(2, 1, 2))
expect_equal(as.numeric(out[3,-c(1:2)]), c(6, 4, 4))
##
data <- data.frame(n = c(1, 1, 5),
n_pos = c(1, 0, 3),
freq = c(10, 2, 4))
out <- impute_root(data, prob_pos = .5,
B = 10)
expect_equal(sum(out$B), 10 * nrow(data))
})
test_that("impute_root_inner", {
df <- data.frame(n = 3,
n_pos = 3,
freq = 1)
out <- impute_root_inner(df, prob_pos = 1,
n = df$n,
n_pos = df$n_pos)
expect_equal(as.numeric(out), c(4, 4, 1))
##
df <- data.frame(n = 3,
n_pos = 3,
freq = 1)
out <- impute_root_inner(df,
prob_pos = 1,
B = 10,
n = df$n,
n_pos = df$n_pos)
expect_equal(as.numeric(out), c(4, 4, 10))
##
df <- data.frame(n = 3,
n_pos = 3,
freq = 4,
B = 5 )
out <- impute_root_inner(df, prob_pos = .5, B = 5,
n = df$n,
n_pos = df$n_pos)
expect_equal(sum(out$B), 5)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.