[R] chisq.test

David L Carlson dcarlson at tamu.edu
Tue Jun 26 23:14:39 CEST 2012


The warning means that you have many cells with expected values less than 5
(4 of 8 cells in this case) so that the chi square estimate may be inflated.
The good news is that the probability of the inflated chi square is .0978
which you probably would not consider to be significant anyway. If you want
to get a simulated p value using Monte Carlo simulation (see the references
in the manual page for chisq.test), just change the call to

chisq.test(tabele, simulate.p.value=TRUE, B=2000)

When I run this five times, I get probability estimates ranging from .09795
to .1089.

Alternatively, get more data.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Omphalodes Verna
> Sent: Tuesday, June 26, 2012 1:28 PM
> To: r-help at r-project.org
> Subject: [R] chisq.test
> 
> Dear list!
> 
> I would like to calculate "chisq.test" on simple data set with 70
> observations, but the output is ''Warning message:''
> 
> Warning message:
> In chisq.test(tabele) : Chi-squared approximation may be incorrect
> 
> 
> Here is an example:
> 
>         tabele <- matrix(c(11, 3, 3, 18, 3, 6, 5, 21), ncol = 4, byrow
> = TRUE)
>         dimnames(tabela) <- list(
>         "SEX" = c("M","F"),
>         "HAIR" = c("Brown", "Black", "Red", "Blonde"))
>         addmargins(tabele)
>         prop.table(tabele)
>         chisq.test(tabele)
> Please, give me an advice / suggestion / recommendation.
> 
> Thanks a lot to all, OV
> 
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list