4 ms·
Yes, as in the OP, S curves can be challenging to work with, in particular, to use, say, early in the history of smart phones, to make long term projections fro
by graycat 7y ago
Yes, as in the OP, S curves can be
challenging to work with, in particular,
to use, say, early in the history of smart
phones, to make long term projections from
the number of smart phones sold each day
for each of the last 30 days.
But there is some good news: The data
used can vary, and in some cases good
projections can be easier to make. Can
see, e.g., for COVID-19 the recent
https://news.ycombinator.com/item?id=22898015 https://news.ycombinator.com/item?id=22898015
https://news.ycombinator.com/item?id=22897967 https://news.ycombinator.com/item?id=22897967
https://news.ycombinator.com/item?id=22900104 https://news.ycombinator.com/item?id=22900104
https://news.ycombinator.com/item?id=22902667 https://news.ycombinator.com/item?id=22902667
In the third one of those we have that the
projection from a FedEx case is the
solution to the first order ordinary
differential equation initial value
problem
y'(t) = k y(t) (b - y(t))
There for data we used y(0) and b. Then we
guessed at k. Had we used values of y for
the past month, we could have picked a
better, likely fairly good, value for k.
Lesson: Fitting an S curve does not have
to be terribly bad.
The key here is the b: The S curve of the
solution is the logistic curve, and it
rises to be asymptotic to b from below.
Knowing b helps a LOT! When have b, are
no longer doing a projection or
extrapolation but nearly just an
interpolation -- much better.
For FedEx, the b was the capacity of the
fleet. For COVID-19 the b would be the
population needed for herd immunity (from
recovering from the virus, from
therapeutics that confer immunity, and a
vaccine that confers immunity).
Knowing b makes the fitting much
easier/better. To know b, likely need to
look at the real situation, e.g.,
population of candidate smart phone users,
candidate TV set owners, market potential
of FedEx (as it was planned at the time),
or population needed for herd immunity for
the people in some relatively isolated
geographic area.
Then in TeX source code, the solution is
y(t) = { y(0) b e^{bkt} \over y(0) \big (
e^{bkt} - 1 \big ) + b}
Can also use a continuous time discrete
state space Markov process subordinated to
a Poisson process. Here's how that works:
Have some states, right, they are
discrete. For FedEx, that would be (i)
the number of customers talking about the
service and (ii) the number of target
customers listening. Then the time to the
next customer is much like the time to the
next click of a Geiger counter, that is,
has exponential distribution, that is, is
the time of the next arrival in a Poisson
arrival process (e.g., the time of the
next arrival at the Google Web site). So
at this arrival, the process moves to a
new state where we have 1 more current
customer and 1 less target customer. Then
start again to get the next new customer.
The Markov assumption is that the past and
future of the process are conditionally
independent given the present state; so
that justifies our getting to the next
state using only the current state --
given the current state, for predicting
the future, everything before that is
irrelevant.
What is a Markov process, what satisfies
that the Markov assumption, can depend on
what we select for the state -- roughly
the more we have in the state, the closer
we are to Markov. In particular, if we
take the whole past history of the process
as the state, IIRC every process is
Markov. But Markov helps in something
like the FedEx application since that
state is so simple.
We get to use continuous time since the
time to the next change of state is from a
Poisson process whose arrival times are
the continuum -- that is, we don't have to
make time discrete although it is true
that the history of the process (one
sample path) has state changes only at
discrete times.
So, for state change, and for some
positive integer n we have some n possible
states, then for i, j = 1, 2, ..., n, we
can have some p(i,j) which is the
probability of jumping from state i to
state j, that is, we have an n x n matrix
of transition probabilities.
[p(i,j) is the conditional probability of
entering state j given that the last state
was i.]
For two jumps, square that matrix. Now
there is a lot of pretty math -- get some
limits and eigenvectors of states, etc.
Actually fairly generally there is a
closed form solution to the process.
Alas, often in practice that closed form
is useless because the n and the n x n are
so large, maybe n^2 in the trillions.
E.g., in a problem I solved for war at
sea, there were Red weapons, Blue weapons,
on each side some number types and some
number of weapons of that type. The
states were the combinatorial explosion.
Then there were the one on one Red-Blue
encounters where one died, the other died,
both died, or neither died. The time to
an encounter was the next arrival of
Poisson processes, also Poisson. Well,
that was an example where there was a
closed form solution but n and n x n were
wildly too large for the closed form
solution but running off, say, 500 sample
paths via Monte-Carlo was easy to program
and fast for the computer. So, sure the
software reported the average of the 500
sample paths. On a PC today, my software
would be done before could get finger off
the mouse button or the Enter key.
This approach is fairly general. And
since what I did included attack
submarines, SSBN submarines,
anti-submarine destroyer ships, long range
airplanes, etc., there should be no
difficulty building such a model for
COVID-19 that included babies, grade
school kids, ..., nursing home residents,
people at home, people working nearly
alone on farms, ....
Back to S curves, IIRC dropping out of the
math for the n x n matrix and its powers
is an S curve. So, in a broad range of
cases, always get an S curve although a
different curve depending on, yes, the
p(i,j) and the initial state. Uh, when no
one is left sick, the Markov process
handles that as an absorbing state --
once get there, don't leave.
For the n in the billions, the n x n is
really a biggie. So, for the submarine
problem I did,
J. Keilson, Green's Function Methods in
Probability Theory.
asked "How can you possibly fathom that
enormous state space?". That is a good
question, and my answer was: "After, say,
5 days, the number of SSBNs left is a
random variable. It is bounded. So it
has finite variance. So, both the strong
and weak laws of large numbers apply. So,
run off 500 sample paths, average them,
and get the expectation within a gnat's
ass nearly all the time. Intuitively,
Monte Carlo puts the effort where the
action is.". Keilson was offended by
"gnat's ass" but liked the math and
approved my work for the US Navy. That
question and answer are good to keep in
mind.
There is more in, say,
Erhan Çinlar, Introduction to Stochastic
Processes, ISBN 0-13-498089-1,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
For why the arrival times have exponential
distribution and why we get a Poisson
process, Çinlar has a nice simple,
intuitive, useful axiomatic derivation.
There is more via the renewal theorem in
William Feller, An Introduction to
Probability Theory and Its Applications,
Second Edition, Volume II, ISBN
0-471-25709-5, John Wiley & Sons, New
York, 1971.
- srean 7y agoThere's quite a bit more to COVID-19 prediction than standard derivation of a logistic curve found in introductory differential equation books. SIR models would perhaps be the simplest place to start. https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#Bio-mathematical_deterministic_treatment_of_the_SIR_model https://en.wikipedia.org/wiki/Compartmental_models_in_epidem...
- graycat 7y agoNice reference. The discussion is mostly about SIR (for susceptible, infected and recovered) models but also with several generalizations to handle more details, e.g., losing immunity and getting infected again. A lot of this material goes back, say, to 1927. First cut it appears that the differential equation I gave is an SIR model except with R = 0, i.e., once are a customer of FedEx then remain one. At one point article finds the logistic curve as I did -- maybe for the same situation. The article does touch on stochastic models, but I didn't see discussion of a Markov assumption or Poisson process for time to the next infection. There is an unclear reference to operator spectral radius, and maybe that is related to the eigenvalues, vectors I mentioned. Whatever, especially with the Wikipedia reference, it appears that we are a step or two beyond the OP. The work I did and described here I did decades ago and is not at all related to the math of my startup now. So, here I was able to describe some of my old work, but I'm doing other things now. For the differential equation I gave, the solution as I derived it needed only ordinary calculus and not the additional techniques of differential equations. I just did the derivation in a hurry at FedEx just as a little calculus exercise. I didn't consult a differential equations book. I discovered that the solution was the logistic curve only by accident years later. The Wikipedia article is nice.
- srean 7y agoYes that's I nice way to run into logistic. Some introductory books use that as a motivating example, usually the second one. SIR is too simple to be accurate, but is ok enough to paint with broad brush strokes. Sometimes simple models are still useful as long as one does not read too much into the output. Statistical epidemiology is quite heavily invested in stochastic differential equation. Wikipedia would hardly suffice as an academic, up to date and an exhaustive bibliography.