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gf_2(
alpha = ifelse(pdf$dr[[i]], 1/6, 0),
xi1 = 1/3,
xi2 = 1/3,
p1 = pdf$p1[[i]],
p2 = pdf$p2[[i]])
if (any(gf < TOL)) {
which_0 <- gf < TOL
for (j in seq_len(nrow(xmat))) {
if (!all(xmat[j, which_0] == 0)) {
expect_true(is_impossible(x = xmat[j, ], g1 = pdf$p1[[i]], g2 = pdf$p2[[i]], dr = pdf$dr[[i]]))
} else {
expect_false(is_impossible(x = xmat[j, ], g1 = pdf$p1[[i]], g2 = pdf$p2[[i]], dr = pdf$dr[[i]]))
}
}
} else {
expect_false(is_impossible(x = xmat[j, ], g1 = pdf$p1[[i]], g2 = pdf$p2[[i]], dr = pdf$dr[[i]]))
}
}
})
test_that("is_valid_2() works", {
expect_true(is_valid_2(dr = 1/6, pp = 1/3, drbound = 1/6))
expect_false(is_valid_2(dr = 1/6, pp = 1/3 - 1e-6, drbound = 1/6))
expect_false(is_valid_2(dr = 1/6, pp = 1/3 + 1e-6, drbound = 1/6))
expect_true(is_valid_2(dr = 0, pp = 0, drbound = 1/6))
expect_true(is_valid_2(dr = 0, pp = 1, drbound = 1/6))
})
test_that("three and two equal", {
tau <- 1/2
beta <- 1/6
gamma <- 1/3
ell <- 2
p3 <- pvec_tet_3(tau = tau, beta = beta, gamma = gamma, ell = ell)
par <- three_to_two(tau = tau, beta = beta, gamma = gamma)
alpha <- par[[1]]
xi <- par[[2]]
p2 <- pvec_tet_2(alpha = alpha, xi = xi, ell = ell)
expect_equal(p2, p3)
})
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.