Skip to content
Prev 64268 / 398498 Next

Tests on contingency tables

Thanks a lot for your help !

Right ! According to tables, most factors look indeed highly dependent...
but, because of strange p-values and warning messages, as I tried to test it
with Chisquare test, and because Fisher's Exact Test function doesn't work
on my data, I wondered whether there were other functions to perform such
tests.

I will try with test independence via a log-linear model.
Is this code correct ? (I can't catch exactly how to put 'formula' argument)
Call:
loglm(formula = ~ins + pl, data = z)

Statistics:
                      X^2 df P(> X^2)
Likelihood Ratio 286.1236 49        0
Pearson          450.5332 49        0


Jacques

-----Message d'origine-----
De : Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Envoye : mardi 15 fevrier 2005 17:41
A : Jacques VESLOT
Cc : R-HELP; jerome.goudet at unil.ch
Objet : Re: [R] Tests on contingency tables


You can test independence via a log-linear model.  More importantly, you
can model that dependence and learn something useful about the data.

I don't see your point here: the two factors are clearly highly dependent:
who cares what the exact p value is?   Did you do e.g. a mosaicplot as I
suspect the dependence is obvious in any reasonable plot?
On Tue, 15 Feb 2005, Jacques VESLOT wrote:

            
the
using
with
chisq.test(table(data$ins.f,
The help file does says

      Note this fails (with an error message) when the entries of the table
      are too large.

Note, the _entries_, not the dimensions.  The issue is how many tables
need to be enumerated.
g.stats(data.frame(as.numeric(data$ins.f),as.numeric(data$ins.s)))$g.stats
--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595