Re: [R] ci.pd() (Epi) and Newcombe method

From: Ted Harding <Ted.Harding_at_manchester.ac.uk>
Date: Wed, 06 Feb 2008 17:29:38 -0000 (GMT)


On 06-Feb-08 17:09:59, Peter Dalgaard wrote:

> (Ted Harding) wrote:

>> Greetings!
>>
>> I suspect that there is an error in the code for the
>> function ci.pd() in the Epi package.
>>
> Any particular reason not to include the maintainer among the > recipients??

Oversight, and haste! Thank you for copying your reply (with my original message) to him. And apologies to Bendix.

Ted.

> Not sure whether Bendix is subscribed.
> 
>     -p
> 

>> This function is for computing confidence intervals
>> for a difference of proportions between two independent
>> groups of 0/1 responses, and implements the Newcombe
>> ("Nc") method and the Agrasti-Caffo "AC" method.
>>
>> I think there is an error in the computation for the
>> Newcombe method.
>>
>> Specifically, where the code says
>>
>> # Put the data in the right form
>> x1 <- aa; n1 <- aa+cc; p1 <- x1/n1
>> x2 <- bb; n2 <- bb+dd; p2 <- x2/n2
>> pd <- x1/n1 - x2/n2
>> z <- qnorm(1-alpha/2)
>> zz <- qchisq(1-alpha/2,1)
>>
>> I believe zz (which is used in the Newcombe method,
>> while z is used for Agresti-Caffo) should be
>>
>> zz <- qchisq(1-alpha,1)
>>
>> (though I think they could just as well have written
>> xx <- z^2), since z^2 seems to be what they want for the
>> Newcombe method, and qnorm(1-alpha/2)^2 = qchisq(1-alpha,1)
>>
>> This was noticed as a result of comparing results from
>> ci.pd() with results from the RDCI module in STATA (run
>> by someone else, since I don't have access to STATA).
>> With the original code in ci.pd(), the Newcombe results
>> were different between ci.pd() and STATA. After making
>> the above change, they agreed.
>>
>> I would be most grateful if anyone who has also been
>> down this path could confirm whether I am correct.
>> Since I don't have access to Newcombe's original
>> paper at the moment either, I am not able to check
>> the code against his own description of the method!
>>
>> With thanks,
>> Ted.
>>
>> --------------------------------------------------------------------
>> E-Mail: (Ted Harding) <Ted.Harding_at_manchester.ac.uk>
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 06-Feb-08 Time: 16:58:19
>> ------------------------------ XFMail ------------------------------
>>
>> ______________________________________________
>> R-help_at_r-project.org 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.
>>
> 
> 
> -- 
>    O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45)
> 35327918
> ~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)                  FAX: (+45)
> 35327907
> 
> ______________________________________________
> R-help_at_r-project.org 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.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding_at_manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 06-Feb-08                                       Time: 17:29:34
------------------------------ XFMail ------------------------------

______________________________________________
R-help_at_r-project.org 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. Received on Wed 06 Feb 2008 - 17:38:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Feb 2008 - 18:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive