# Likelihood of continuing a discrete series

If I have a series like "aaabbbabaabaabbaa" and I'd like to know whether next element in series is "a" or "b", would a Poisson distribution be best solution for this? If so, checking Poisson for "3" wouldn't be right since it can be >3 in the future. Would the the proper solution be 1-(P(1)+P(2))?

Thanks

-

If you can assume that the string distribution is stationary, which means that the probability of occurence of "a" or "b" does not depend on the absolute position in your string, I would use a nth-order Markov model. This means that you model the probability $P(s[i]|s[i-1],...,s[i-n])$. You can simply estimate it via relative frequency.
For example, if you use a first order Markov model, you get $$P(s[i]=a|s[i-1]=a) = \frac{\#(s[i]=a \mbox{ and } s[i-1]=a)}{\#(s[i-1]=a)}$$ and similarly for $P(s[i]=a|s[i-1]=b)$, $P(s[i]=b|s[i-1]=a)$, and $P(s[i]=b|s[i-1]=b)$.