R/score_function_phi.R

Defines functions score_function_phi

Documented in score_function_phi

score_function_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]

  # -N * lam2 - N0 * lam2 + m01 / phi +
  #   (z1 * (1 - theta1) * lam2) / (theta2 * lam2 + (1 - theta1) * lam2 * phi) +
  #   (z2 * theta1 * lam2) / ((1 - theta2) * lam2 + theta1 * lam2 * phi)

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