R/beta_predict.r

Defines functions beta_predict

Documented in beta_predict

beta_predict <- function(p, calib){
  p <- pmax(1e-16, pmin(p, 1-1e-16))
  d <- data.frame(p)
  if (calib$parameters == "abm"){
    d$lp <- log(p)
    d$l1p <- -log(1-p)
  }else if (calib$parameters == "am"){
    d$lp <- log(p / (1 - p))
  }else if (calib$parameters == "ab"){
    d$lp <- log(2 * p)
    d$l1p <- log(2*(1-p))
  }
  return(predict(calib$model, newdata=d, type="response"))
}

Try the betacal package in your browser

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

betacal documentation built on May 1, 2019, 10:24 p.m.