https://github.com/cran/pracma
Revision 26e049d70b4a1c237987e260cba68f6a9413736c authored by Hans W. Borchers on 09 April 2019, 04:10:07 UTC, committed by cran-robot on 09 April 2019, 04:10:07 UTC
1 parent bf07673
Tip revision: 26e049d70b4a1c237987e260cba68f6a9413736c authored by Hans W. Borchers on 09 April 2019, 04:10:07 UTC
version 2.2.5
version 2.2.5
Tip revision: 26e049d
sigmoid.R
##
## s i g m o i d . R Sigmoid Function
##
sigmoid <- function(x, a = 1, b = 0) {
if (length(x) == 0) return(c())
stopifnot(is.numeric(x), is.numeric(a), is.numeric(b))
a <- a[1]; b <- b[1]
1 / (1 + exp(-a*(x-b)))
}
logit <- function(x, a = 1, b = 0) {
if (length(x) == 0) return(c())
stopifnot(is.numeric(x), is.numeric(a), is.numeric(b))
a <- a[1]; b <- b[1]
if (x < 0 || x > 1) return(NaN)
if (x >= 0 && x <= 1)
return(b + log(x/(1-x))/a)
else
return(NaN)
}
Computing file changes ...