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
and are 48 rows by 116 columns.  I have managed to do something with them,
but I don't think it is right as I got a p value of 1.  In this case I used
the read.table() function to read the values from the files.  But I don't
know if this was right.

 

 

> x=read.table(file="C:/Program Files/R/R-2.2.1/Projects/Stats EU/Expected
input.txt")

 

> y=read.table(file="C:/Program Files/R/R-2.2.1/Projects/Stats EU/Observed
input.txt")

 

> chisq.test(x,y)

 

 

 

 

Pearson's Chi-squared test

 

data:  x 

X-squared = 4.4602, df = 5405, p-value = 1

 

Warning message:

Chi-squared approximation may be incorrect in: chisq.test(x, y)

 

 

 

 

Maybe the scan() function is more correct??  Using this I got:

 

 

> x=scan(file="C:/Program Files/R/R-2.2.1/Projects/Stats EU/Observed
input.txt")

Read 5568 items

 

> y=scan(file="C:/Program Files/R/R-2.2.1/Projects/Stats EU/Expected
input.txt")

Read 5568 items

 

> chisq.test(x,y)

 

        Pearson's Chi-squared test

 

data:  x and y 

X-squared = 172306.4, df = 13880, p-value < 2.2e-16

 

Warning message:

Chi-squared approximation may be incorrect in: chisq.test(x, y)

 

 

 

Any help would be much appreciated.

Regards,

 

Carina


        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

Reply via email to