[R] need help for chi-squared test

Greg Snow Greg.Snow at imail.org
Thu Jan 6 21:52:56 CET 2011


David,

I think the poster wants to use one of the columns as x and the other as y, ignoring the remaining columns.  If that is the case then he/she needs to read the section in "Introduction to R" on subsetting data frames.

I agree that the output so far is meaningless, from the degrees of freedom it looks like chisq.test is interpreting the data frame as a 1245 by 4 contingency table.  The thing that concerns me is the lack of any warnings or errors, if there truly were not any warnings then how is it interpreting counts of 0.25? and I would expect the number of 0's in the part shown to generate the warning about cell sizes too small.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of David Winsemius
> Sent: Thursday, January 06, 2011 1:14 PM
> To: kiotoqq
> Cc: r-help at r-project.org
> Subject: Re: [R] need help for chi-squared test
> 
> 
> On Jan 6, 2011, at 2:34 PM, kiotoqq wrote:
> 
> >
> > I used chisq.test(read.table("C:/Users/Maggy/Downloads/dust.asc",
> > header=TRUE))
> 
> So, where did you download this data and when is your homework due?
> 
> >
> > and got this
> >
> >        Pearson's Chi-squared test
> >
> > data:  read.table("C:/Users/Maggy/Downloads/dust.asc", header = TRUE)
> > X-squared = 5226.164, df = 3735, p-value < 2.2e-16
> >
> > and I think it should be right for the whole set,
> 
> I, on the other hand. now suspect it is a meaningless set of numbers.
> 
> 
> > but that's not what I
> > need, because I only have to use it for "cbr" and "smoking"
> 
> Do you mean you have an understanding of the potential values of cbr
> and smoking in that data and that you want to restrict your analysis
> to some subset defined by particular values  of those variables?
> 
> 
> > --
> > View this message in context: http://r.789695.n4.nabble.com/need-
> help-for-chi-squared-test-tp3177925p3178052.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > 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.
> 
> David Winsemius, MD
> West Hartford, CT
> 
> ______________________________________________
> 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.



More information about the R-help mailing list