# [R] test for equal distributions with small numbes of observations

Carlos J. Gil Bellosta sigma at consultoresestadisticos.com
Tue Aug 19 11:04:11 CEST 2003

```Probably, to check homogenity you only need to consider a vector of
dimension 8 consisting in the number of times you get any of the
configurations (0,7), (1,6), (2,5),...(7,0). This is most likely a
sufficient statistics. Under homogeneity, it should be distributed
according to a multinomial random variable with probability vector equal
to the density of a binomial variable of unknown parameter p.

Then you can use standard tests to see if the MVE fits or if it does not
fit the data.

Carlos J. Gil Bellosta

Christoph Lehmann wrote:

>Dear R-pros
>
>I have a problem, for which usually I would apply a chisq.test or a
>fisher.test:
>
>
>
>40 objects, each given either a "0" or "1", regarding if this object
>later on will be remembered by a subject or not.
>
>7 subjects investigated
>
>means: we have a 2x40 matrix, each cell the number of subjects for who
>the object i has been given either "0" or "1" e.g.
>
>objects:
>	1	1	3		39	40
>	------------------------------------------
>"0"	1	2	2	..	7	7
>"1"	4	4	5	..	0	0
>
>over all 40 objects, we have 67% of "1" and 33% of "0"
>
>I want to know, if for the 40 objects, the ratio of "0"/"1" differs or
>not, i.e. if they have the same distribution.
>
>I cannot use a chisq.test since the expected frequencies are < 5 for the
>"0" cells.
>
>Fisher.test seems to run for > 12h on a PIV 1.8GHz...
>
>what do you recommend me to do?
>
>Many thanks
>
>Christoph
>--
>
>
>>recognition
>>
>>
>     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
>[1,]    1    2    2    2    2    3    3    3    3     3     3     3     4     4
>[2,]    4    4    5    4    4    3    4    4    4     4     3     4     3     3
>     [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
>[1,]     4     4     4     4     4     4     5     5     5     5     5     5
>[2,]     3     2     3     3     2     3     2     2     2     2     2     2
>     [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
>[1,]     5     5     5     5     5     6     6     6     6     6     6     6
>[2,]     2     2     2     2     2     1     1     1     1     1     1     1
>     [,39] [,40]
>[1,]     7     7
>[2,]     0     0
>
>
>
>>fisher.test(recognition)
>>
>>
>
>
>
>

```