Hacker News new | ask | show | jobs
by claudiusd 2248 days ago
> considering all s-curves are exponentials at the beginning

Sorry, but I hear a lot of people saying this and it's driving me crazy. S-curves are S-curves from the beginning, not exponentials. It can be useful to use an exponential growth model at the beginning of the curve for short-term forecasting, but these two models will diverge dramatically at the S-curve inflection point.

Not that we shouldn't plan as if exponential growth will occur in a crisis like we're in now, but many people I know don't understand these dynamics and it has lead to a lot of undue panic.

4 comments

There are different kinds of S-curves.

Some of them are basically exponential at the beginning (the logistic curve). This makes perfect sense in modelling an infectious disease - initially, all contacts are susceptible. Thus you have exponential growth.

Others, for example the CDF of a normal (which is often confused with the logistic), is not exponential at the beginning, but decays much faster (the derivative is exp(-x^2)).

Arctan decays much slower (derivative is 1/(1+x^2)).

So, S-curves are sort of linear in the middle, but sort of exponential or exp(-x^2) or 1/(1+x^2) or hyperbolic at the ends, and which one of them it is tells us a lot about their behaviour.

Note also that without any social distancing or other measures and a sustained Rt of, say, 3, the inflection point will only occur once about a third of the population are infected, and thus it makes perfect sense to model it exponentially while still being below 5%, say.

The thing is: a good fit at the tail end (with bad data) may very well be a very bad fit for the global (nonlinear) curve. Because you cannot linearize the data or the model.

Non-linear fitting is VERY hard to do well. And with pathetic data like now, it is doomed.

Some s-curves are never well-modeled by an exponential for any substantial part (of course the exponential will be approximately linear over a short enough range but then you might as well use a line), like for example arctan. Not all s-curves are logistic functions (although in the context of epidemiology, then I guess people usually just mean logistic by s-curve).
Thank you for this response. All smooth curves are also approximately linear at all points, but that doesn't mean that we can't usefully predict and model an appropriate non-linear fit.
Not disagreeing, what you say seems right to me, but it ("All smooth curves ...") also seems like the sort of result that there might be a counterexample to, like a smooth curve that at no scale has a linear approximation. Maybe a fractal with a smoothly varying generator??

For curves of infection rates I don't doubt your verity.

“Smooth” is a term of art in math that means continuously differentiable infinitely many times. These functions are a subset of those functions that are differentiable once.

Differentiable once means, by definition, approximable everywhere by a line at small enough scale.

Yes, I know that much.

Imagine a sine wave, except when you look at it at 1000x magnification it's a sin + cos. It looks smooth, and at x = π you think that the derivative will be -1 but in fact it's 0 because you don't have a sine crossover there you have a cosine trough.

Except at 1000000 times magnification (ie another 1000) the cosine curve that forms that apparent sine curve is itself a sine curve. So everything is switched again.

f(x) is something like sin(x)+cos(ax)/a+sin(a^2x)/a^2+cos(a^3x)/a^3+ ... (sin(x.a^j)/a^j+cos(x.a^j+1)/a^j+1+ ...

for a=some arbitrary large number. Something like that, I'm a bit rusty, sorry.

At whatever scale you look at the curve the derivative is always wrong: you zoom in on the sine, at the peak it's got a cosine, so the d/dx is -1; but zoom in and the cosine has a sine at the crossing point, so the d/dx is 0; but zoom in and ...

The curve is provably smooth, it's sinuses all the way down, but nowhere can you tell the derivative as it's fractal???

That's what I had in mind.

Anyway, I thought their might be clever curves of that type.

A curve with the properties you describe is not smooth, by definition, since it is not differentiable.

> At whatever scale you look at the curve the derivative is always wrong: you zoom in on the sine, at the peak it's got a cosine, so the d/dx is -1; but zoom in and the cosine has a sine at the crossing point, so the d/dx is 0; but zoom in and ...

This is pretty much the definition of something not being differentiable. "Differentiable" means that the approximations to the derivative (i.e., difference quotients) converge to some fixed value as the scale they're measured at approaches the infinitely small.

You might be interested in the Weierstrass function, which seems to be the sort of thing you're getting at with your idea: https://en.wikipedia.org/wiki/Weierstrass_function . Continuous everywhere, but differentiable nowhere.

Edit: the specific function you wrote down is not differentiable (at least not everywhere). For example, at x=0, its derivative, if it had one, should be cos(0) + cos (a * 0) + cos (a^2 * 0) + ... , but that series clearly diverges.

cos(0) being 1, sin (0) begin 0; that series is 0 + 10e-3 + 0 + 10e-9 + 0 + 10e-15 + ... when x=0 (excuse my sloppy notation, I'm on a phone). Looks convergent to me, somewhere between 0.001000001000001 and 0.001000001000002 ?

Have you studied fractal dimensions formally, might I know the background you're speaking from?

Yes, I'm imagining, as a first example, something akin to a Weierstrass function but without the discontinuities.

https://www.desmos.com/calculator/c6tbl4zr9j

> “Smooth” is a term of art in math that means continuously differentiable infinitely many times. These functions include, as a subset, functions which are differentiable once.

Of course you knew what you meant, but, for anyone who's confused, the containment goes the other way.

You’re right. Edited to fix the error.
the unstated condition there is that the window for approximating linearity must be flexible for a given error envelope - smaller windows for higher rates of change of the curve. so while technically correct, it isn’t always practically useful.