produce_samples <- function(N, p, phi, theta, len, f) {
PI <- p * (1 - theta) + (1 - p) * phi
n <- f * N
M <- (1 - f) * N
nprobs <- c(
(1 - p) * (1 - phi),
(1 - p) * phi,
p * theta,
p * (1 - theta)
)
rbind(
rmultinom(len, n, nprobs),
rmultinom(len, M, c(PI, 1 - PI))
) %>%
t() %>%
as_tibble(.name_repair = "minimal") %>%
set_names(c("n00", "n01", "n10", "n11", "X", "Y"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.