R/convert.threshold.to.er.R

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

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

#' @rdname nncvis
#' @export
convert.threshold.to.er <- function(threshold, mean, sd,
                                    eventIfHigher = TRUE,
                                    pdist = stats::pnorm) {
  return(pdist(threshold, mean=mean, sd=sd, lower.tail=!eventIfHigher));
}

#' @rdname nncvis
#' @export
convert.er.to.threshold <- function(er, mean, sd,
                                    eventIfHigher = TRUE,
                                    qdist = stats::qnorm) {
  q <- qdist(er);
  if (eventIfHigher) {
    return(mean - q * sd);
  } else {
    return(mean + q * sd);
  }
}

Try the behaviorchange package in your browser

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

behaviorchange documentation built on March 7, 2023, 7:24 p.m.