sigmoid: Sigmoid function

View source: R/sigmoid.R

sigmoidR Documentation

Sigmoid function

Description

Returns S-shaped functions, monotonically increasing between two constants with a point symmetry at the half-way point.

Usage

sigmoid(x, type = 1, fmin = 0, fmax = 1, xmid = 0, slope = 1)

Arguments

x

real argument between -Inf and +Inf, can be a vector

type

number or character string, specifying the type of function. The following expressions vary between -1 and +1 with a slope of 1 at the symmetry x=0.
tanh (1): hyperbolic tangent function, tanh(x), which becomes the logistic function, 1/(1+exp(-x)), if all arguments kept at default.
atan (2): arctangent function, 2/pi*atan(pi/2*x)
err (3): error function, erf(sqrt(pi)/2*x)
sqrt (4): algebraic function with root, x/sqrt(1+x^2)
abs (5): algebraic function with absolute value, x/(1+abs(x))
gd (6): Gudermannian function, 4/pi*atan(tanh(pi/4*x))

fmin

asymptotic function minimum at x=-Inf

fmax

asymptotic function maximum at x=+Inf

xmid

point of symmetry, where the function value is (fmin+fmax)/2

slope

slope of the function at x=xmid

Value

Returns a vector with the same number of elements as x

Author(s)

Danail Obreschkow

Examples

col = c('red','orange','#cccc00','#00bb00','blue','purple')
for (i in seq(6)) {
  graphics::curve(sigmoid(x,i),-3,3,add=i>1,col=col[i],ylab='sigmoid(x)')
}
graphics::lines(c(-1.5,1.5),c(-1,2),lty=2)


obreschkow/cooltools documentation built on Nov. 16, 2024, 2:46 a.m.