Calculate area under a sigmoid curve that crosses the x axis

calculus

I am fitting the following function to bacterial growth data
$$
f(x) = L – \frac{U-L}{\left( 1 + e^{-k_1(x-x_0)} \right)^{1/v}\left( 1 + e^{-k_2(x-x_0)} \right)^{1/v}}
$$

One example looks like this:

enter image description here

Although it is hard to tell, it crosses the x axis (upper asymptote is approximately 0.24).
I can easily compute the integral in some interval using scipy.integration.quad in Python. However, what this gives me is the area "over" the curve up to x=0, right? The AUC is supposed to function as a proxy for the total amount of bacterial growth.

Given the integration

$$
\int\limits_0^b f(x) dx
$$

a more representation of the AUC would be the area bounded by $f(x)$, $f(a)$, $x=a$, and $x=b$. Which sort of looks like this

enter image description here

Is there a simple way get this kind of AUC?

Best Answer

You haven't answered my question, but based on the rest of your post, I'm guessing it means "Area Under Curve". (Tip: unless you are absolutely sure your audience will already know your acronyms, either explain them, or do not use them).

Note that if $f > g > 0$ everywhere in the interval $[a, b]$, then the area under $y = f(x)$ is the sum of the area under $y = g(x)$ and the area between $y = f(x)$ and $y = g(x)$.

So the area between the two curves is given by $$A = \int_a^b f(x)\,dx - \int_a^b g(x)\,dx = \int_a^b(f(x) - g(x))\,dx$$ This is still true when $f, g$ are not necessarily $ > 0$, but it isn't as intuitive. You still need $f \ge g$ for the area to make sense, though.

In your case, $g(x)$ is a constant function: $g(x) = f(a)$ for all $x$. So the area you describe is

$$A = \int_a^b f(x)\,dx - \int_a^b f(a)\,dx$$ Since that latter curve is just a horizontal line, the area under it is a rectangle, with area $f(a)(b-a)$. So finally,

$$A = \left(\int_a^b f(x)\, dx\right) - f(a)(b-a)$$

Related Question