# [R] Find if there is independence

vito muggeo vito.muggeo at giustizia.it
Fri May 24 09:47:18 CEST 2002

```Hi alessandro,
your problem concerns making inference in nonstandard situations, such a
sparse data, sampling zeros and small sample size, where asymptotic theory
doesn't hold.

A conditional approach, i.e. Fisher test for contigency tables, might be the
best solution (and the only one in my experience), although some author does
not rely on conditional principle. The alternative unconditional exact
approach is computationally proibitive for non-2x2 tables.

StatXact is specifically designed for these nonstandard analyses.

However in practice it is suggested that if the three tests (LRT, Score,
Wald) yield the same p-value, asymptotics results may be used.

best,
vito

----- Original Message -----
From: "Ambrosini Alessandro" <klavan at tiscalinet.it>
To: "R-help" <R-help at stat.math.ethz.ch>
Sent: Thursday, May 23, 2002 9:27 PM
Subject: [R] Find if there is independence

> Hello
> I have the matrix
>
> a<-matrix(c(2,1,0,1,2,2,1,5,7,2,5,12),nrow=6)
> a
>
>       [,1] [,2]
> [1,]    2    1
> [2,]    1    5
> [3,]    0    7
> [4,]    1    2
> [5,]    2    5
> [6,]    2   12
>
> Suppose that in the first row we have 3 men of England, 2 with hair, and 1
> no
> In the second we have 6 italian men, 1 with hair and 5 no ...
> I want to find if there is a dependence between men withouth hair and
> nationality.
> By the way, which is the simplest command to use to study the independence
> in a matrix like the one that I wrote?
> Using
> > chisq.test(a)
>
>         Pearson's Chi-squared test with Yates' continuity correction
>
> data:  a
> X-squared = 0, df = 1, p-value = 1
>
> Warning message:
> Chi-squared approximation may be incorrect in: chisq.test(a)
>
> Why does it give me the warning message? What have to add into
chisq.test(a)
> ?
> And in which value I can understand the level of the dependence?
> Thank you
> Alessandro
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```