# How to determine long-term coexistence in a stochastic simulation?

I wrote a stochastic simulation to investigate a system in which replicators proliferate in compartments (rudimentary cells). The compartments contain two kinds of replicators: master sequences and mutants. Mutants can drive the system into extinction. I'm interested in where coexistence is possible in the parameter space.

The Model

The link above points to a version with non-overlapping generations, but these systems are usually modelled with overlapping generations. The following image is the flow diagram of the model with overlapping generations.

$$N$$ is the compartment population size, $$n$$ is the number of master sequences in a given compartment, and $$m$$ is the number of mutants in a given compartment, $$s$$ is split size (the total number of replicators in a compartment at which the compartment divides).
The metabolic efficiency of a compartment is the number of master sequences it harbours divided by the total number of master sequences in the system.
Replication happens by randomly choosing a replicator based on replication rates. If a master sequence is chosen to replicate, it mutates to a mutant with probability $$U$$.
One generation corresponds to $$N$$ compartment divisions.
The population counts as extinct when there are no master sequences left in any compartment.

My aim

With a given $$(N,s,\text{relative mutant replication rate})$$ combination, I search for the highest value of the mutation rate, with two decimal place accuracy, at which the population survives, i.e. master sequences and mutants coexist.
Coexistence does look different from extinction. It looks like an equilibrium:

But I'm reluctant to call it an equilibrium because this is a stochastic model with one absorbing state, so as far as I know, the mutant will eventually fix with probability $$1$$.

How to determine what counts as coexistence?

It is usually done by choosing a maximal number of generations. This choice is primarily constrained by the available computing power and time.
For example, I have done preliminary simulations of the above system with an insane amount of maximal generations. It turned out that the majority of extinctions happens before $$20000$$ generations. And the appearance of time series figures like the above seemed, uh, pretty equilibrium-like in the cases when the system has reached $$20000$$ generations. So I decided to regard it as coexistence when the system has reached $$20000$$ generations.
But this seems quite subjective and imprecise. There must be a better way to determine coexistence than guessing it based on figures. Note that I don't want to determine when the system will never go extinct because I actually think it will eventually certainly go extinct (see above). I want to distinguish somehow quick extinction from coexistence during runtime.

I have heard that some do it by fitting a line to the values of a relevant variable (e.g. the number of master sequences in the system) along the generations. They regard it as coexistence and stop the simulation when the slope of this line ceases to be significantly different from zero.
But how should that work? This seems very suspicious to me, raising questions about stopping rules and multiple testing.
Indeed, someone I asked about this said that I shouldn't use significance testing for this. They suggested that I should examine the confidence interval of the slope instead and regard it as coexistence when there are only irrelevant values in the confidence interval. But then, how is that more objective?

Questions

So what is a proper, statistically sound way to do this? What are the relevant search terms of this topic of determining the "equilibrium" of a system like this?

• The best way is to study the system theoretically to develop a quantitative expression for the rate of decay. Have you done that? What are the results?
– whuber
Commented Jun 29, 2021 at 15:43
• @whuber Hmm, I'm afraid I don't know what do you mean. I am sorry. Would you elaborate? Commented Jun 29, 2021 at 16:10
• Let me put it like this: your question is stated so generally that it's unanswerable. (Some of the bad advice about testing can be addressed, though.) It's simply impossible to make (nontrivial) inferences about all future generations based on a finite number of them unless you have a quantitative model for how the future is likely to behave.
– whuber
Commented Jun 29, 2021 at 16:25
• @whuber I have edited my question. Unfortunately, these models are not analysed mathematically because they are said to be too complicated. My maths is not nearly as advanced to disprove this. I warmly welcome any textbook suggestions. I'm at the level of this book. Commented Jun 30, 2021 at 6:08