Learn R Programming

virtualspecies (version 1.6)

logisticFun: Logistic function

Description

A simple logistic function of the form $$\frac{1}{{1 + e^{\frac{x - \beta}{\alpha}}}}$$

Usage

logisticFun(x, alpha, beta)

Value

a numeric value or vector resulting from the function

Arguments

x

a numeric value or vector

alpha

a numeric value or vector

beta

a numeric value or vector

Author

Boris Leroy leroy.boris@gmail.com

Maintainer: Boris Leroy leroy.boris@gmail.com

Details

The value of beta determines the 'threshold' of the logistic curve (i.e. the inflexion point).

The value of alpha determines the slope of the curve (see examples):

  • alpha very close to 0 will result in a threshold-like response.

  • Values of alpha with the same order of magnitude as the range of x (e.g., the range ofx / 10) will result in a logistic function.

  • alpha very far from 0 will result in a linear function.

See Also

linearFun, quadraticFun

Examples

Run this code
x <- 1:100
y <- logisticFun(x, alpha = -10, b = 50)
plot(y ~ x, type = "l")

# The effect of alpha:
y1 <- logisticFun(x, alpha = -0.01, b = 50)
y2 <- logisticFun(x, alpha = -10, b = 50)
y3 <- logisticFun(x, alpha = -1000, b = 50)

par(mfrow = c(1, 3))
plot(y1 ~ x, type = "l", main = expression(alpha %->% 0))
plot(y2 ~ x, type = "l", main = expression(alpha %~~% range(x)/10))
plot(y3 ~ x, type = "l", main = expression(alpha %->% infinity))

Run the code above in your browser using DataLab