# Fitting a geometric distribution to data

1. Jun 11, 2012

Let's say I have a series of 100 coin tosses, heads or tails. In fact (for my actual data) I don't know if subsequent trials are correlated or what the actual probabilities of getting heads or tails are. Nevertheless, I want to fit a geometric distribution, which gives me the distribution of the number of tails seen before a head come up.

Now I'm unsure how to actually approach this in practice. Can I take each point in the sequence and calculate how many tails come before a head, or would this overcount by using overlapping sequences. For example 4 heads in a row would be counted once as 4, then as 3 and then as 2 and 1 and 0 if i used this scheme. Alternatively do I take random samples as starting points or do I start each time the series alternates between heads and tails? If the series were uncorrelated (which the geometric distribution models it as) then it shouldnt matter which of these schemes I choose.

2. Jun 12, 2012

### Stephen Tashi

Such questions don't have mathematical answers unless enough information is given. You say that you want to "fit" a geometric distribution but not that your are willing to do the fit using the assumption that the data is really from a geometric distribution.

If we assume the data is from a geometric distribution then, in the jargon of statistics, you are asking what "estimator" to use for the parameter of the geometric distribution. This still doesn't define what your would consider a "good" estimator is, but it tells us that what you should look up on the web is the topic: "estimators of the parameter of a geometric distribution".

Without looking that up myself, I suspect that the simple estimator $\hat{p} =$ (number of successes)/ (total number of trials) is best at attaining the things people usually want from an estimator ( small bias, small variance). I'm too lazy at the moment to confirm this, but we can investigate this further if it will answer your question.

Let suppose don't want to asume the data is from a geometric distribution. To determine waht estimator to use, you have to say something more definite about what family of distributions generate the data. Merely saying trials are correlated isn't enough to specify a family of probability distributions, even if you were to state the coefficient of correlation.

If you want to know what's done "in practice" you need to describe what your data is. Someone who has analyzed similar data might know. The practice for one kind of success-fail data is not necessarily the same as the practice for another kind.

3. Jun 12, 2012

I understand what you're saying here. What I really wanted to do was to count up the number of sequences of heads of each length in the data and compare it to that generated by the geometric distribution. I decided to simply find the indices in the sequence which came up tails and count the gaps inbetween. This is the same as if I had tossed the coin until it came up tails, marked the number of heads that had come up, and then started again. And by the way, I'm doing this to try to replicate some analysis in a paper that was not at all clear.

4. Jun 13, 2012

### Stephen Tashi

You're saying that you want to reduce specific statistics from the data and compare them to statistics that would be generated by the geometric distribution. What do have in my when you say "compare"?

There are rwo common meanings of the word "statistic". One meaning is that a statistic is a specific numerical result of an algorithm (like 38.63 ) that is computed from given numerical data in a sample.

Another meaning of statistic is that it is an algorithm for computing a value from a sample of data. For example, computing the sample mean can be defined as an algorithm. In this sense of the word "statistic", a statistic is a random variable because the inputs to the algorithm are random samples. The statistics generated by a geometric distribution are random variables.

How can we compare a specific number to a random variable? There are various ways. One is to ask the probability that the random variable is equal to the specific number, or within plus or minus some delta of it. Another way is to ask whether the mean of the random variable is equal to the specific number or within plus or minus of some delta of it. If the analysis you are checking makes a comparision, how is it done?

5. Jun 13, 2012