R/Wald_phi.R

Defines functions Wald_phi

Documented in Wald_phi

Wald_phi <- function(
  z1 = 40, z2 = 77, m01 = 15, m02 = 12, y01 = 6, y02 = 1,
  N0 = 0.7, N = 27.89, alpha = 0.05
) {

  data <- c(z1, z2, m01, m02, y01, y02, N0, N)
  crit <- qnorm(1 - alpha / 2)
  mles <- calculate_mles_pois(data)
  phihat <- mles[1]
  se <- tryCatch(
    solve(info_matrix(mles, data))[1, 1],
    error = function(e) NaN
  )
  if (is.nan(se)) return(tibble(W_Lower = NaN, W_Upper = NaN))
  else {
    lower <- phihat - crit * sqrt(se)
    upper <- phihat + crit * sqrt(se)
    tibble(W_Lower = lower, W_Upper = upper)
  }
}
BriceonWiley/IntegratedLikelihood.R documentation built on Aug. 21, 2020, 11 p.m.