In chisq.test(x) : Chi-squared approximation may be incorrect

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

In chisq.test(x) : Chi-squared approximation may be incorrect

My Coyne
Hello,

 

I received the following warning when running chi-square;

n  Is there a way to catch the 'error' code of 'warning' after run
chisq.test(x)?

n  What does this error mean?

 

Thank you for your help.

 

 


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: In chisq.test(x) : Chi-squared approximation may be incorrect

anna freni sterrantino
Hi!
 the warning you got
"Chi-squared approximation may be incorrect"
is because probably there are less than 5 observations in
the cell. Maybe will help to
try fisher.test()

Cheers

Anna







----- Messaggio originale -----
Da: My Coyne <[hidden email]>
A: [hidden email]
Inviato: Lunedì 14 gennaio 2008, 21:51:30
Oggetto: [R] In chisq.test(x) : Chi-squared approximation may be incorrect

Hello,

 

I received the following warning when running chi-square;

n  Is there a way to catch the 'error' code of 'warning' after run
chisq.test(x)?

n  What does this error mean?

 

Thank you for your help.

 

 


    [[alternative HTML version deleted]]

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






      ___________________________________

ttp://it.docs.yahoo.com/nowyoucan.html
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: In chisq.test(x) : Chi-squared approximation may be incorrect

My Coyne
Thank you for your help; I will try fisher.test().

 

 

From: anna freni sterrantino [mailto:[hidden email]]
Sent: Tuesday, January 15, 2008 8:53 PM
To: [hidden email]; [hidden email]
Subject: Re: [R] In chisq.test(x) : Chi-squared approximation may be incorrect

 

Hi!
 the warning you got
"Chi-squared approximation may be incorrect"
is because probably there are less than 5 observations in
the cell. Maybe will help to
try fisher.test()

Cheers

Anna








----- Messaggio originale -----
Da: My Coyne <[hidden email]>
A: [hidden email]
Inviato: Lunedì 14 gennaio 2008, 21:51:30
Oggetto: [R] In chisq.test(x) : Chi-squared approximation may be incorrect

Hello,



I received the following warning when running chi-square;

n  Is there a way to catch the 'error' code of 'warning' after run
chisq.test(x)?

n  What does this error mean?



Thank you for your help.






    [[alternative HTML version deleted]]

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





  _____  

  _____  

L'email della prossima generazione? Puoi averla con la nuova <http://us.rd.yahoo.com/mail/it/taglines/hotmail/nowyoucan/nextgen/*http:/it.docs.yahoo.com/nowyoucan.html>  Yahoo! Mail


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: In chisq.test(x) : Chi-squared approximation may be incorrect

Simon Blomberg-4
Why do people automatically jump to Fisher's Exact test? That test
conditions on BOTH marginal row totals. Usual contingency table analyses
condition on one margin, at most. You should look very carefully at the
underlying model for your data. Fisher's Exact test might not be
appropriate. Agresti's "Categorical Data Analysis" has a good discussion
of this.

Simon.

On Tue, 2008-01-15 at 21:49 -0500, My Coyne wrote:

> Thank you for your help; I will try fisher.test().
>
>  
>
>
>
> From: anna freni sterrantino [mailto:[hidden email]]
> Sent: Tuesday, January 15, 2008 8:53 PM
> To: [hidden email]; [hidden email]
> Subject: Re: [R] In chisq.test(x) : Chi-squared approximation may be incorrect
>
>  
>
> Hi!
>  the warning you got
> "Chi-squared approximation may be incorrect"
> is because probably there are less than 5 observations in
> the cell. Maybe will help to
> try fisher.test()
>
> Cheers
>
> Anna
>
>
>
>
>
>
>
>
> ----- Messaggio originale -----
> Da: My Coyne <[hidden email]>
> A: [hidden email]
> Inviato: Lunedì 14 gennaio 2008, 21:51:30
> Oggetto: [R] In chisq.test(x) : Chi-squared approximation may be incorrect
>
> Hello,
>
>
>
> I received the following warning when running chi-square;
>
> n  Is there a way to catch the 'error' code of 'warning' after run
> chisq.test(x)?
>
> n  What does this error mean?
>
>
>
> Thank you for your help.
>
>
>
>
>
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>
>
>
>
>
>   _____  
>
>   _____  
>
> L'email della prossima generazione? Puoi averla con la nuova <http://us.rd.yahoo.com/mail/it/taglines/hotmail/nowyoucan/nextgen/*http:/it.docs.yahoo.com/nowyoucan.html>  Yahoo! Mail
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: In chisq.test(x) : Chi-squared approximation may be incorrect

Marc Schwartz
I would also review:

Chi-squared and Fisher-Irwin tests of two-by-two tables with small
sample recommendations
Ian Campbell
Stat in Med 26:3661-3675; 2007
http://www3.interscience.wiley.com/cgi-bin/abstract/114125487/ABSTRACT

and the bottom Frank Harrell's page here:

http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/DataAnalysisDisc

where he has some comments on the above.

HTH,

Marc Schwartz

Simon Blomberg wrote:

> Why do people automatically jump to Fisher's Exact test? That test
> conditions on BOTH marginal row totals. Usual contingency table analyses
> condition on one margin, at most. You should look very carefully at the
> underlying model for your data. Fisher's Exact test might not be
> appropriate. Agresti's "Categorical Data Analysis" has a good discussion
> of this.
>
> Simon.
>
> On Tue, 2008-01-15 at 21:49 -0500, My Coyne wrote:
>> Thank you for your help; I will try fisher.test().
>>
>>
>>
>>
>>
>> From: anna freni sterrantino [mailto:[hidden email]]
>> Sent: Tuesday, January 15, 2008 8:53 PM
>> To: [hidden email]; [hidden email]
>> Subject: Re: [R] In chisq.test(x) : Chi-squared approximation may be incorrect
>>
>>
>>
>> Hi!
>>   the warning you got
>> "Chi-squared approximation may be incorrect"
>> is because probably there are less than 5 observations in
>> the cell. Maybe will help to
>> try fisher.test()
>>
>> Cheers
>>
>> Anna
>>
>>
>>
>>
>>
>>
>>
>>
>> ----- Messaggio originale -----
>> Da: My Coyne<[hidden email]>
>> A: [hidden email]
>> Inviato: Lunedì 14 gennaio 2008, 21:51:30
>> Oggetto: [R] In chisq.test(x) : Chi-squared approximation may be incorrect
>>
>> Hello,
>>
>>
>>
>> I received the following warning when running chi-square;
>>
>> n  Is there a way to catch the 'error' code of 'warning' after run
>> chisq.test(x)?
>>
>> n  What does this error mean?
>>
>>
>>
>> Thank you for your help.
>>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: In chisq.test(x) : Chi-squared approximation may be incorrect

David Winsemius
In reply to this post by My Coyne
"My Coyne" <[hidden email]> wrote in
news:000e01c8573a$ad60c8a0$082259e0$@com:

> I received the following warning when running chi-square;
>
> n  Is there a way to catch the 'error' code of 'warning' after run
> chisq.test(x)?

It is not an error message. It is a warning message. When I assign the
result of chisq.test(.) to an object and then look at its structure
with str(), I do not see the warning message "in there". Instead the
message appears on the console. When you look at the chisq.test
function itself you see that any "E" less than 5 will trigger the
warning:

if (any(E < 5) && is.finite(PARAMETER))
        warning("Chi-squared approximation may be incorrect")

You should be able to check the <object>$expected matrix in a similar
manner if you goal is to process a large number of tables
programatically.

>
> n  What does this error mean?

See above. Consider invoking chisq.test with the simulate.p.value
option.

--
David Winsemius

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