# How to calculate the confidence interval of a discrete time stochastic process?

Please feel free to edit if the question title is not accurate.

I want to see if a mutation that is observed has a higher frequency that what can be expected out of random. So I have $$N_0$$ individuals of genotype $$a$$ which over time acquire a single mutation over time to become genotype $$b$$. The probability of mutation is $$\mu$$. So the expected number of $$a$$ after $$t$$ generations would be:

\begin{align}N_{t} &= N_{t-1}(1-\mu)\\[1em] & = N_0(1-\mu)^t\end{align}

I derive $$\mu$$ as Poisson-probability of non-zero mutations when the mutation rate is $$\lambda$$.

$$\mu = \beta(1-e^{-\lambda})$$

where $$\beta$$ is probability of a certain mutation type.

I have data on frequencies (actually counts but the population size is not constant) of different mutations at different time points. This is obtained from DNA sequencing. I also have data on the mutation rate ($$\lambda$$) and mutational biases ($$\beta$$) again calculated using DNA sequencing. How do I say that the observed value is significantly higher than expected? There is only one sample; so I cannot do a $$\chi^2$$ test. Is there some kind of exact test?

I am not interested in the biological aspects of the problem. My data is about mutations and genes but this problem could be generalized as a pure death process. There are $$n$$ individuals in a population and there is a death probability $$p$$ per generation. What is the probability that $$k$$ or more individuals will be dead after $$t$$ generations?

EDIT

I tried to describe the probabilities using an equation of the form:

$$P(n=k,t\,|\,n_0)= P(k-1,t-1)\mu + P(k,t-1)(1-\mu)$$

Since there can be more than one mutations per time step, I model the probabilities using binomial distribution.

\begin{align} P(k,t)&=\sum_{i=0}^{k}P(k-i,t-1)B(n-k,i,\mu)\\[0.5em] P(k,1)&=B(n_0,k,\mu)\\[1.5em] B(n,k,p)&={n\choose k}p^k(1-p)^{n-k} \end{align}

Here, $$n_0$$ is the initial population size.

To calculate the probability I wrote a recursive function (in MATLAB):

function pf = bintraj(n,k,p,t)
if(t==1)
pf=binopdf(k,n,p);
else
pf=0;
for i=0:k
pf=pf+bintraj(n,k-i,p,t-1)*binopdf(i,n-k,p);
end
end


Now, I wanted to do a one tailed exact test for which I want to find the cumulative probability up to $$k-1$$.

What I observe is that the sum of probabilities ($$k=0$$ to $$k=n_0$$) is less than 1.

Is there something wrong with my model?

• First, do you care about anomalies in the distribution of genotypes, or in the mutation rate, assuming you can find either? They are not perfectly equivalent.
– jkm
Commented Nov 19, 2019 at 11:00
• @jkm the distribution of genotypes Commented Nov 19, 2019 at 12:01
• Could you describe all data (or data-points) you have and how the data is obtained? In my current understanding, what you ask for is impossible, which most likely means I didn't quite understand which data you have. Commented Nov 26, 2019 at 10:57
• @KaPy3141 Edited the question to add that. Let me know if it is fine. Basically the data is a table of different mutations and corresponding frequencies. Commented Nov 26, 2019 at 11:10
• @WYSIWYG: Do you have lambda and beta for every single gene in the genome or is your data limited to a single gene? Commented Nov 26, 2019 at 11:39

I wanted to ask this as a comment but I run out of space:

Just to get it right: You interpret your raw data in 2 ways:

1: You create a graph showing the accumulation of mutations over time/generations, from which you determine the (relative) mutation rate.

2: You create a graph showing the ratio of gene-copies that have 0 mutations over all gene-copies.

Then you create a (binomial) model, that has to be able to fit graph 1 (as a test to your model, or maybe this is how you determine the rates in the first place), with the aim of reformulating this model to create a curve that shows the expected values of graph 2. And if this model-graph 2 was significantly different to the observed one, you wouldn't interpret this as a failure of the model but as a biological signal?

What is this signal? It shows that mutation rate combined (in unmutated gene-copies and mutated gene-copies combined) is different to the mutation rate in unmutated copies only? So you suggest that the cells have an advantage/disadvantage having at least 1 mutation in the gene?

Then also you have mathematical problems with your model. (This can be treated as a separate point)

If you could confirm this, then it could serve helpful to other people or me to come up with a good approach.

• 1. No, I obtain the mutation rate from the control experiment where no selection is performed. This is independent of the data on mutation frequencies. This measurement is made to check the method used for generating mutations. The data is obtained after selection. Commented Nov 26, 2019 at 12:46
• 2. Just to be clear: the gene is only one copy per individual. I count the number of individuals in the population having a certain mutation in the gene (allele frequency). This is done on the population under selection. Commented Nov 26, 2019 at 12:49
• OK, I get it. @2: yea that's clear. Commented Nov 26, 2019 at 12:50
• Finally. Let's not make this a biology problem. My question is simple. It is like a death only process. You start with n individuals and there is a death probability, p. What is the probability that k or more individuals will be dead after t generations? Commented Nov 26, 2019 at 12:52