calculate_mles_binom <- function(data) {
# browser()
n00 <- data[1]; n01 <- data[2]; n10 <- data[3]
n11 <- data[4]; X <- data[5]; Y <- data[6]
lam1hat <- n11 / (n01 + n11)
# if (is.nan(lam1hat)) lam1hat <- 0
lam2hat <- n10 / (n00 + n10)
# if (is.nan(lam2hat)) lam2hat <- 0
pihat <- (X + n01 + n11) / (n00 + n01 + n10 + n11 + X + Y)
phat <- pihat * lam1hat + (1 - pihat) * lam2hat
list(
"phat" = phat,
"pihat" = pihat,
"lam1hat" = lam1hat,
"lam2hat" = lam2hat,
"sample" = data
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.