R/calculate_mles_pois.R

Defines functions calculate_mles_pois

Documented in calculate_mles_pois

calculate_mles_pois <- function(data) {
  z1 <- data[1]; z2 <- data[2]; m01 <- data[3]; m02 <- data[4]
  y01 <- data[5]; y02 <- data[6]; N0 <- data[7]; N <- data[8]
  z01 <- m01 - y01 + y02; z02 <- m02 - y02 + y01
  lam1hat <- (z1 + m01 + (y01 * z2) / z02 - (y02 * z1) / z01) / (N + N0)
  lam2hat <- (z2 + m02 + (y02 * z1) / z01 - (y01 * z2) / z02) / (N + N0)
  theta1hat <- (y01 * z01 * (z2 + z02)) /
    (y01 * z01 * (z2 + z02) + (m01 - y01) * z02 * (z1 + z01))
  theta2hat <- (y02 * z02 * (z1 + z01)) /
    (y02 * z02 * (z1 + z01) + (m02 - y02) * z01 * (z2 + z02))
  c(
    phihat = lam1hat / lam2hat,
    lam2hat = lam2hat,
    theta1hat = theta1hat,
    theta2hat = theta2hat # removed lam1hat
  )
}
BriceonWiley/IntegratedLikelihood.R documentation built on Aug. 21, 2020, 11 p.m.