1
$\begingroup$

I need to transform my data into a function shown below.
My data should fit in the range from 0 to 1. The inflection point should be on 0.5.

How I can do this mathematically?
Is there any similar function to model data like this?

enter image description here

$\endgroup$
  • $\begingroup$ What are the x-axis values where the function hits 0 and 1? $\endgroup$ – Glen_b Sep 26 '17 at 10:12
  • $\begingroup$ @Glen_b: in my real data my values are from 0.1 up to > 15. Why I need at the value of y = 1 sth. like a damping factor. However, on the more naive step, we can approximate this by using easier values like for y=0,5 => x=0,5 or y=1 => x=1 $\endgroup$ – mario Sep 26 '17 at 10:26
  • 2
    $\begingroup$ The cumulative distribution function of any unimodal and symmetric distributed random variable will result in a S-shaped form, where the inflection point is 0.5 (located at the median of the random variable). standard approaches are logit (see below) or probit (take the cdf of a normal distributed random variable). if you need to force a compact support, then try for example the beta distribution. $\endgroup$ – chRrr Sep 26 '17 at 11:04
  • 1
    $\begingroup$ I don't get the "transform" part. This is what you want, but what do you have? Dividing the data by their maximum will scale to maximum 1, so what else do you want? $\endgroup$ – Nick Cox Sep 26 '17 at 12:17
  • 1
    $\begingroup$ Still unclear because "transform" has not been explained. At best, how to model S curves (as in the last sentence of the question) may be the nub of the question, in which case please rewrite the question to make that clearer. $\endgroup$ – Nick Cox Sep 27 '17 at 6:22
4
$\begingroup$

The sigmoid, S-shaped or ogive curve shown in your plot is ubiquitous in nature. Geoffrey West's recent book Scale: The Universal Laws of Growth, Innovation, Sustainability, and the Pace of Life in Organisms, Cities, Economies, and Companies goes into great depth in elucidating that. Another excellent resource is D'Arcy Thompson's On Growth and Form, much older but still a classic. The bottom line is that symmetric S-shapes are described using Gaussian assumptions.

There are many approaches to modeling these functions beginning with the Gompertz curve--the first model truly nonlinear in the parameters (@1820). Of course, 100 years earlier, Riccati introduced quadratics into differential equations but his "nonlinearity" was in the inputs, not the parameters. About 20 years after Gompertz, Verhulst developed the classic logistic curve, the assumption underlying today's logistic regression. Gompertz and logistic curves differ nontrivially in that the Gompertz is asymmetric and long-tailed while the logistic is symmetric and short-tailed. Given the difficulties many analysts experience in trying to fit rare or large magnitude (+/-) events based on logistic regression, one wishes software developers would come up with canned tools for Gompertz regression.

Since Gompertz and Verhulst, there have been many more S-shaped growth curve functions: for instance, the Pearl curve, the Fisher-Pry transformation, logit functions also do this and more. Wrt model building, multiplicative, log-log models reproduce S-shapes. Introducing quadratic (squared) polynomials into a regression model will work as well. This wiki article goes into much greater depth about sigmoid functions and their variant specifications... https://en.wikipedia.org/wiki/Sigmoid_function.

With all due respect to Geoffrey West, that S-shaped curves are ubiquitous does not qualify them as universal laws. Equally ubiquitous phenomena are extreme value distributed information or data in which large magnitude (+/-) events overwhelm normal, bell-shaped, ordinary information.

I don't know LaTeX or the LaTeX-like functions used on CV but this wiki piece (https://en.wikipedia.org/wiki/Logit, see the Definition section) shows how to fit an S-shaped, logistic curve bounded between 0 and 1 for any number a using an inverse logit function. In words, the inverse logit is exp(a)/(exp(a)+1).

| cite | improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ Interesting and entertaining. This broadens the question beyond the explicit request for functions with inflection half-way. "Gaussian assumptions" are not explained, but. I imagine you're alluding to the use of nonlinear least squares to fit such growth curves. Any good statistical software will have functionality for that and so special-purpose commands for e.g. fitting Gompertz curves are not especially needed. As the response being modelled varies from 0 to 1 (or from minimum to maximum) it is strictly bounded, so I can't see any connection with extreme value distributions. $\endgroup$ – Nick Cox Sep 26 '17 at 12:00
1
$\begingroup$

You can use the inverse logit

x <- rnorm(100, 0, 5)

inv_logit <- function(x) {
  return(1 / (1 + exp(- x)))
}

y <- inv_logit(x)

plot(y ~ x)
| cite | improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ Why would you use random points of evaluation for a function plot? x <- seq(-5, 5, length.out = 100) $\endgroup$ – AlexR Sep 26 '17 at 11:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.