R/convert.threshold.to.er.R

Defines functions convert.threshold.to.er convert.er.to.threshold

Documented in convert.er.to.threshold convert.threshold.to.er

convert.threshold.to.er <- function(threshold, mean, sd,
                                    eventIfHigher = TRUE,
                                    pdist = pnorm) {
  return(pdist(threshold, mean=mean, sd=sd, lower.tail=!eventIfHigher));
}

convert.er.to.threshold <- function(er, mean, sd,
                                    eventIfHigher = TRUE,
                                    qdist = qnorm) {
  q <- qdist(er);
  if (eventIfHigher) {
    return(mean - q * sd);
  } else {
    return(mean + q * sd);
  }
}

Try the userfriendlyscience package in your browser

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

userfriendlyscience documentation built on May 2, 2019, 1:09 p.m.