R/log_likelihood_phi.R

Defines functions log_likelihood_phi

Documented in log_likelihood_phi

log_likelihood_phi <- function(params, phi, data) {
  lam2 <- params[1]; theta1 <- params[2]; theta2 <- params[3]
  z1 <- data[1]; z2 <- data[2]; m01 <- data[3]; m02 <- data[4]
  y01 <- data[5]; y02 <- data[6]; N0 <- data[7]; N <- data[8]

  # m01 * log(phi * lam2) + m02 * log(lam2) - N0 * (phi * lam2 + lam2) +
  #   y01 * log(theta1) + (m01 - y01) * log(1 - theta1) +
  #   y02 * log(theta2) + (m02 - y02) * log(1 - theta2) +
  #   z1 * log(phi * lam2 * (1 - theta1) + lam2 * theta2) +
  #   z2 * log(lam2 * (1 - theta2) + phi * lam2 * theta1) -
  #   N * (phi * lam2 + lam2)

  m01 * log(phi) + (m01 + m02 + z1 + z2) * log(lam2) -
    lam2 * (phi + 1) * (N0 + N) +
    z1 * log(phi * (1 - theta1) + theta2) +
    z2 * log((1 - theta2) + phi * theta1) +
    y01 * log(theta1) + (m01 - y01) * log(1 - theta1) +
    y02 * log(theta2) + (m02 - y02) * log(1 - theta2)
}
BriceonWiley/IntegratedLikelihood.R documentation built on Aug. 21, 2020, 11 p.m.