[R] Chi Square with two tab-delimited text files

David Barron mothsailor at googlemail.com
Mon Feb 26 13:11:53 CET 2007


It's a bit difficult to advise without knowing what the rows and
columns represent, but why not just calculate the statistic yourself,
given that you already have observed and expected values?  For
example:

chi2 <- sum((y-x)^2/x)



On 26/02/07, Carina Brehony <carina.brehony at zoology.oxford.ac.uk> wrote:
> Yes, I would like to do a goodness-of-fit test.
>
> -----Original Message-----
> From: Petr Klasterecky [mailto:klaster at karlin.mff.cuni.cz]
> Sent: 26 February 2007 11:50
> To: Carina Brehony
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Chi Square with two tab-delimited text files
>
> Carina Brehony napsal(a):
> > Hi,
> > I want to do a chi square test and I have two tab delimited text files
> with
> > Expected and Observed values to compare.  Each file contains only the
> values
> <snip>
>
> There are a lot of chi^2 tests, most of them compare O&E quantities and
> it is not clear which one you want to use. I'd guess a goodness of fit
> test, but who knows? See ?chisq.test and the examples given there. It
> also tells you that the y-argument is ignored if x is a matrix (that's
> probably the reason why you get different results using read.table and
> scan).
> Petr
> --
> Petr Klasterecky
> Dept. of Probability and Statistics
> Charles University in Prague
> Czech Republic
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP



More information about the R-help mailing list