R/millsRatio.R

Defines functions millsR

Documented in millsR

millsR <- function(y, log = FALSE) {

  if (log) {
    millsR <- pnorm(y, lower.tail = FALSE, log.p = TRUE) -
              dnorm(y, log = TRUE)
  } else {
    millsR <- ifelse(y < 30, pnorm(y, lower.tail = FALSE)/dnorm(y),
                     exp(pnorm(y, lower.tail = FALSE, log.p = TRUE) -
                         dnorm(y, log = TRUE)))
  }

  return(millsR)
}

Try the NormalLaplace package in your browser

Any scripts or data that you put into this service are public.

NormalLaplace documentation built on Nov. 26, 2023, 1:07 a.m.