[R] Find if there is independence
kjetil halvorsen
kjetilh at umsanet.edu.bo
Fri May 24 20:10:56 CEST 2002
Or you can use chisq.test with simulate.p.value=TRUE
Kjetil Halvorsen
Uwe Ligges wrote:
>
> Ambrosini Alessandro wrote:
> >
> > 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?
>
> Let me ask another question: What is the appropriate method to ...
>
> Since the cells of your contingency table are not very well filled, I'd
> suggest to use Fisher's (general) exact test, if you want to test on
> independency of rows and columns, fortunately you do not need to
> calculate it manually, see ?fisher.test .
>
> > Using
> > > chisq.test(a)
> >
> > Pearson's Chi-squared test with Yates' continuity correction
> >
> > data: a
> > X-squared = 0, df = 1, p-value = 1
>
> No. In my version of R (1.5.0 on WinNT) it results plausibly in:
> X-squared = 6.8155, df = 5, p-value = 0.2347
>
> Are you sure you did the things mentioned above exactly?
>
> > 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?
>
> What does "level of dependence" mean in your case?
> Are you sure you want to quantify it, using such a small number of
> observations and such vague defintions (hair / no hair). To you want to
> quantify it for all countries or separately? But perhaps I misunderstand
> ...
>
> Uwe Ligges
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list