Here is a somewhat DIY approach. Comments?

In article <[EMAIL PROTECTED]>, Bob Parks
<[EMAIL PROTECTED]> writes
>Consider the following problem (which has a real world
>problem behind it)
>
>You have 100 coins, each of which has a different
>probability of heads (assume that you know that
>probability or worse can estimate it).
>
>Each coin is labeled.  You ask one person (or machine
>if you will) to flip each coin a different number of times,
>and you record the number of heads.
>
>Assume that the (known/estimated) probability of heads
>is between .01 and .20, and the number of flips for
>each coin is between 4 and 40.
So there are only about 41 possible different results (# of heads seen)
for each individual coin, and it is possible to calculate the
probability of each of those 41 different results under the null
hypothesis: prob(observed) ~ Binomial(p_know_i, 40) or something
>
>The question is how to test that the person/machine
>doing the flipping is flipping 'randomly/fairly'.  That is,
>the person/machine might not flip 'randomly/fairly/...'
>and you want to test that hypothesis.
>
>One can easily state the null hypothesis as
>
>  p_hat_i = p_know_i  for i=1 to 100
>
>where p_hat_i is the observed # heads / # flips for each i.
>
>Since each coin has a different probability of heads,
>you can not directly aggregate.
>
But here I assume that, for each coin, you can attach some sort of
'score' to each of its 41 possible results. This might be (observed -
expected)^2/expected, or -log(prob observed | null hypothesis), or
something that reflects your desired alternative hypothesis more
closely: e.g. if you are looking for a consistent bias to heads you
might include the sign of the deviation in the score, or if you are
looking for a trend effect you might set scores for a coin according to
its position in your list of 100 coins.

I also assume that the final statistic is produced by summing the
individual scores. The remaining question is how to estimate the
significance of the result.

Chances are, your scores are small floating point numbers. Shift, scale
and round them to convert them all to integers of reasonable size - say
in the range 0,1,2,... 1000. The total score is then in the range
0..40000 or so. It isn't quite as powerful a statistic as the original
one, but it is susceptible to exact calculation. The distribution of an
integer valued score can be represented by an array of floating point
numbers: the probabilities that the score is equal to 0, 1, 2, ...
40000. What is more, the distribution of an independent sum of two such
scores is computed by simply convolving the two distributions. Even
without the FFT, convolving arrays of 1000 and 40,000 floats looks
doable on a modern machine. In fact, it's easier than that because only
41 of the 1000 floats in the smaller of the two arrays to be convolved
at each stage are non-zero. Repeat this process 100 times and you've got
the exact distribution of your final (integer-valued) score.
-- 
A. G. McDowell


===========================================================================
This list is open to everyone.  Occasionally, less thoughtful
people send inappropriate messages.  Please DO NOT COMPLAIN TO
THE POSTMASTER about these messages because the postmaster has no
way of controlling them, and excessive complaints will result in
termination of the list.

For information about this list, including information about the
problem of inappropriate messages and information about how to
unsubscribe, please see the web page at
http://jse.stat.ncsu.edu/
===========================================================================

Reply via email to