R/produce_samples.R

Defines functions produce_samples

Documented in produce_samples

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"))
}
BriceonWiley/IntegratedLikelihood.R documentation built on Aug. 21, 2020, 11 p.m.