R/scale_to_01.R

Defines functions bin scale_to_01

Documented in bin scale_to_01

#'Scale to [0,1]
#'@examples
#'scale_to_01(35:85)
#'(35:85-35)/(85-35)
#'scale_to_01(runif(10))
#'@param x Vector.
#'@export scale_to_01
scale_to_01 <- function(x) {
    a <- min(x)
    b <- max(x)
    return((x - a)/(b - a))
}
NULL
#'Binomial function
#'@param n Integer.
#'@param i Integer(i < n).
#'@param x Numeric(0<= x <=1).
#'@examples
#'bin(5,3,.5)
#'@export bin
bin <- function(n, i, x) {
    choose(n, i) * x^i * (1 - x)^(n - i)
}
NULL

Try the BayesBP package in your browser

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

BayesBP documentation built on Aug. 28, 2020, 1:10 a.m.