[R] chisq.test and cbind

From: Simone Santoro <miseno77_at_hotmail.com>
Date: Sun, 13 Mar 2011 19:26:17 +0100

Hi,

This is a mixed conceptual/methodological issue.

I have 3 years and 2 localities, I want to compare the Sex Ratio series between the two localities.

I can do it year by year, for instance:

> SR2010<-data.frame(FAO=c(96,52),JUNC=c(60,42))

> SR2010

  FAO JUNC 1 96 60

2 52 42

> chisq.test(SR2010)

        Pearson's Chi-squared test with Yates' continuity correction

data: SR2010

X-squared = 0.6995, df = 1, p-value = 0.4030

Or perhaps I could be interested
in testing if there is any difference in SR along my time series (just three years), is that correct?:

> data1<-data.frame(Mfao=c(173,96,96),Ffao=c(136,62,52),Mjunc=c(7,26,60),Fjunc=c(5,23,42))

> data1

  Mfao Ffao Mjunc Fjunc

1 173 136 7 5

2 96 62 26 23

3 96 52 60 42

> attach(data1)

> chisq.test(cbind(Mfao,Ffao),cbind(Mjunc,Fjunc))

        Pearson's Chi-squared test

data: cbind(Mfao, Ffao)

X-squared = 3.4443, df = 2, p-value = 0.1787

Thanks in advance for any response                                                

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 13 Mar 2011 - 18:39:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Mar 2011 - 18:40:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive