R/helpers.R

Defines functions f_cstar h

# Contrast function
h <- function(x, y, contrast) {
  func <- log(x) - log(y)
  if (contrast=="Difference") { func <- x - y }
  if (contrast=="VE") { func <- 1 - x/y }
  return(func)
}

# Define helper function for Imbens-Manski interval computation
f_cstar <- function(c, low, up, maxsig) {
  pnorm(c + (up - low) / maxsig) - pnorm(-c) - 0.95
}
bblette1/psbinary documentation built on June 18, 2021, 10:11 p.m.