[Rd] Chi-squared test (PR#9350)

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Thu Nov 9 06:53:48 CET 2006


On Nov 8, 2006, at 9:44 PM, Kasper Daniel Hansen wrote:

> Upon further reflection on my part I have realized that my original
> email was way too harsh - even for the sometimes harsh tone on R- 
> devel.
>
> Having spent a few more minutes reflecting on the original question
> and reading the old thread Robert linked to, it seems that there is
> indeed some questions about the non-existence of a df argument.
>
> I guess it can be interesting in the case where you are comparing to
> an estimated probability vector and you want to take that estimation
> into account (which does not seem straightforward, see Peter
> Dalgaard's old email). In that case a user might be interested in
> explicitly passing along a df argument.
>
> On the other hand, there are several circumstances where I would say
> a df is unnecessary. One case is when the p value is computed by
> simulation and another is the case where the argument is a matrix and
> the function tests for independence (at least it would be highly non-
> standard to have any other degrees of freedom that the usual one).
>
> Since the function returns the statistic it is very easy to directly
> compute the df by
>    statistic = chisq.test( ... )$statistic
>    p.value = 1 - pchisq(statistic, df = df)
> (or p.value = pchisq(statistic, df = df, lower.tail = FALSE) ).

Ok, I am writing pretty bad here, this paragraph should fo course read

Since the function returns the statistic it is very easy to directly
compute the p-value for a given degrees of freedom by
    statistic = chisq.test( ... )$statistic
    p.value = 1 - pchisq(statistic, df = df)
(or p.value = pchisq(statistic, df = df, lower.tail = FALSE) ).


> Altogether I would personally be slightly inclined to say it is
> better not to provide a df argument - I would think that the
> possibility of misuse is to high.
>
> Kasper
>
>
>
> On Nov 8, 2006, at 7:40 AM, McGehee, Robert wrote:
>
>> Is Sahotra's abuse sending a wishlist item to R-bugs, or is his error
>> phrasing a suggestion in the form of a question? It seems others have
>> commented on the inability to specify df for chisq.test (see:
>> http://tolstoy.newcastle.edu.au/R/help/05/01/10539.html), and
>> adding an
>> option certainly seems like a reasonable suggestion to me.
>>
>> And of course, R-FAQ 9.2 does explicitly give a standard for  
>> reporting
>> wishlist or non-bug items to the R-bugs:
>> "There is a section of the bug repository for suggestions for
>> enhancements for R labelled `wishlist'. Suggestions can be
>> submitted in
>> the same ways as bugs, but please ensure that the subject line makes
>> clear that this is for the wishlist and not a bug report, for
>> example by
>> starting with `Wishlist:'."
>>
>> So if your qualm is with how onerous and manual the R bugs tracking
>> system is, rather than if the sender sent his question/comment to the
>> wrong list or in the wrong form, then perhaps an upgrade to the R bug
>> tracker is in order rather than discouraging sending wishlist  
>> items to
>> the bugs archiving system.
>>
>> Robert
>>
>> -----Original Message-----
>> From: r-devel-bounces at r-project.org
>> [mailto:r-devel-bounces at r-project.org] On Behalf Of Kasper Daniel
>> Hansen
>> Sent: Tuesday, November 07, 2006 10:24 PM
>> To: sarkar at mail.utexas.edu
>> Cc: R-devel
>> Subject: Re: [Rd] Chi-squared test (PR#9350)
>>
>> (not cc'ed to R-bugs)
>>
>> If this is not a bug why do you abuse the bug report system to ask a
>> simple question? Now a member of R-core has to use valuable time to
>> handle this bug report, time that could be far more profitable spent
>> making improvements to R (or spend it otherwise). This is incredible
>> selfish behavior.
>>
>> Kasper
>>
>> On Nov 7, 2006, at 5:41 PM, sarkar at mail.utexas.edu wrote:
>>
>>> Full_Name: Sahotra Sarkar
>>> Version: 2.2.0
>>> OS: Windows XP
>>> Submission from: (NULL) (128.83.34.44)
>>>
>>>
>>> This is not a bug: I'm just wondering why chisq.test does not allow
>>> the
>>> specification of the degree of freedom (df).
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list