[R] a statistic question about chisq.test() (aprilsun)

2003-03-27 Thread Bob Porter
The Chisquare test is based upon a normal approx of the (essentially) binomial
distribution for the data in question.  Small EXPECTED (not observed) values
(<5) suggest a asymetric distribution and potential errors in inferential
conclusions.  The alternative is the exact test, which calculates the exact
probabilities of the observed distribution, or a more extreme one, given the
constraining expectations.

It is usually much more useful to make the statistics fit the data question than
to assume or force the vice versa.

--Bob Porter, Tampa


> Hi,
> In the chisq.test(), if the expected frequency for some categories is <5,
there will be a warning message which says
> Warning message:
> Chi-squared approximation may be incorrect in: chisq.test(x, p = probs)
>
> I am wondering whether there are some methods to get rid of this mistake...
Seems the ?chisq.test() doesn't provide more
> options to solve this problem. Or, the only choice is to preprocess the data
to avoid this situation?
>
> Thanks a lot!
>
> aprilsun

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] a statistic question about chisq.test()

2003-03-26 Thread kjetil brinchmann halvorsen
On 26 Mar 2003 at 13:35, aprilsun wrote:

First, look at the expected values under the null. If only a few are 
below 5 and all are above 1 there are probably no problem.

Second, you can use chisq.test with the argument
simulate.p.value=TRUE

Kjetil Halvorsen


> Hi, 
> In the chisq.test(), if the expected frequency for some categories is <5, there will 
> be a warning message which says
> Warning message: 
> Chi-squared approximation may be incorrect in: chisq.test(x, p = probs)
> 
> I am wondering whether there are some methods to get rid of this mistake... Seems 
> the ?chisq.test() doesn't provide more
> options to solve this problem. Or, the only choice is to preprocess the data to 
> avoid this situation?
> 
> Thanks a lot!
> 
> aprilsun
> 
>   [[alternate HTML version deleted]]
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] a statistic question about chisq.test()

2003-03-26 Thread Wiener, Matthew
One other option.

I usually find that when I do the chisq.test with exact p-value calculation,
I find the p-values are nearly identical to the results when I use the
approximation and get the warnings (I'm usually dealing with just a few bins
with less than 5, and many bins with more than 5).

So frequently, when I'm using chisq.test in a program, and expect to do it
many times, I'll sometimes eliminate the warnings this way:

old.warn <- options()$warn
options(warn = -1)
< do the chisq.test here >
options(warn = old.warn)

This will suppress the warning messages.  

Hope this helps.

Matt Wiener

-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 4:24 PM
To: aprilsun
Cc: [EMAIL PROTECTED]
Subject: Re: [R] a statistic question about chisq.test()


aprilsun wrote:
> 
> Hi,
> In the chisq.test(), if the expected frequency for some categories is <5,
there will be a warning message which says
> Warning message:
> Chi-squared approximation may be incorrect in: chisq.test(x, p = probs)

It's a warning message, not an error. It point's you to the problem that
a number < 5 is not "large", whereas in theory "large" numbers are
assumed when running this test.

 
> I am wondering whether there are some methods to get rid of this
mistake... Seems the ?chisq.test() doesn't provide more
> options to solve this problem. Or, the only choice is to preprocess the
data to avoid this situation?

It depends on the problem. Fisher's exact test (or it's extended
version) might be an alternative, see ?fisher.test and an appropriate
statistics textbook.

Uwe Ligges


> Thanks a lot!
> 
> aprilsun

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


--

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] a statistic question about chisq.test()

2003-03-26 Thread Uwe Ligges
aprilsun wrote:
> 
> Hi,
> In the chisq.test(), if the expected frequency for some categories is <5, there will 
> be a warning message which says
> Warning message:
> Chi-squared approximation may be incorrect in: chisq.test(x, p = probs)

It's a warning message, not an error. It point's you to the problem that
a number < 5 is not "large", whereas in theory "large" numbers are
assumed when running this test.

 
> I am wondering whether there are some methods to get rid of this mistake... Seems 
> the ?chisq.test() doesn't provide more
> options to solve this problem. Or, the only choice is to preprocess the data to 
> avoid this situation?

It depends on the problem. Fisher's exact test (or it's extended
version) might be an alternative, see ?fisher.test and an appropriate
statistics textbook.

Uwe Ligges


> Thanks a lot!
> 
> aprilsun

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] a statistic question about chisq.test()

2003-03-26 Thread aprilsun
Hi, 
In the chisq.test(), if the expected frequency for some categories is <5, there will 
be a warning message which says
Warning message: 
Chi-squared approximation may be incorrect in: chisq.test(x, p = probs)

I am wondering whether there are some methods to get rid of this mistake... Seems the 
?chisq.test() doesn't provide more
options to solve this problem. Or, the only choice is to preprocess the data to avoid 
this situation?

Thanks a lot!

aprilsun

[[alternate HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help