test_that("loglike_cond_fast", {
p_plus <- .6
p_neg <- .4
clust_df <- data.frame(i_pos = 2,
i_neg = 0,
n_pos = 3,
n = 4,
freq = 2)
out <- loglike_cond_fast(p_plus, p_neg, clust_df)
exp_out <- (1 - .6)^3 *
(1 - .4)^1 *
.6^2 *
.4^0 * 2
expect_equal(out, log(exp_out/2))
#########################
p_plus <- .6
p_neg <- .4
clust_df <- data.frame(i_pos = 2,
n_pos = 3,
n = 4,
freq = 2)
out <- loglike_cond_fast(p_plus, p_neg, clust_df)
exp_out <- (1 - .6)^3 *
(1 - .4)^1 *
.6^2 *
.4^1 * 2
expect_equal(out, log(exp_out / 2))
#######################################
p_plus <- .6
p_neg <- .4
clust_df <- data.frame(i_pos = 2,
n_pos = 3,
n = 4,
freq = 2)
out <- loglike_cond_fast(p_plus, p_neg, clust_df,
is_truncated = TRUE,
w_pos = .75)
exp_out <- (1 - .6)^3 *
(1 - .4)^1 *
.6^2 *
.4^1 * 2 / (.75 * (.4) + .25 * (.6))
expect_equal(out, log(exp_out / 2))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.