Re: [R] Chi Square Test on two groups of variables

From: Guohui Ding <gohidg_at_gmail.com>
Date: Fri 27 May 2005 - 11:22:39 EST

If 'oxygen' is a matrix with one row or column, 'oxygen' is treated as a one-dimensional contingency table. In this case, the hypothesis tested is whether the population probabilities equal those in 'p', or are all equal if 'p' is not given.

you can convert the 'oxygen' and 'train' variables to vector or take a two-dimensional contingency table by matrix(c(oxygen, train), nr=2).

you will get more information when you type ?chisq.test.

2005/5/27, Brett Stansfield <brett@hbrc.govt.nz>:
>
> Dear R help
> I have been trying to conduct a chi square test on two groups of variables
> to test whether there is any relationship between the two sets of variables
>
> chisq.test(oxygen, train)
>
> Pearson's Chi-squared test
>
> data: oxygen
> X-squared = 26.6576, df = 128, p-value = 1
>
> > chisq.test(oxygen)
>
> Pearson's Chi-squared test
>
> data: oxygen
> X-squared = 26.6576, df = 128, p-value = 1
>
> It looks as if R is only reading the first set of variables pertaining to
> oxygen. Is there a way for it to test for two groups of variables?
>
> brett stansfield
>
> Brett Stansfield
> Environmental Scientist - Water Quality
> Hawke's Bay Regional Council
> 102 Vautier Street
> Private Bag 6006
> Napier
> Phone (06) 835-9200 extn 9334
> Fax (06) 835-3601
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
ADDRESS: Bioinformatics Center, Shanghai Institutes for Biological
Sciences, Chinese Academy of Sciences
320 Yueyang Road, Shanghai 200031, P.R.China
TELEPHONE: 86-21-54920086

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri May 27 11:26:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:08 EST