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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 = 1No. 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 intochisq.test(a)> ? > And in which value I can understand the level of the dependence? > Thank you > Alessandro > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-> r-help mailing list -- Readhttp://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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._