Bug 14216 - pchisq accuracy
pchisq accuracy
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Accuracy
old
ix86 (32-bit) Windows 32-bit
: P5 normal
Assigned To: Jitterbug compatibility account
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-19 03:46 UTC by Jitterbug compatibility account
Modified: 2010-02-19 03:46 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jitterbug compatibility account 2010-02-19 03:46:17 UTC
From: Jerry.Lewis@biogenidec.com
Full_Name: Jerry W. Lewis
Version: 2.10.1
OS: Windows XP Professional
Submission from: (NULL) (166.186.168.21)


Since
  pchisq(x,df,ncp,lower.tail,TRUE)
is calculated as
  log(pchisq(x,df,ncp,lower.tail))
it looses accuracy when pchisq(x,df,ncp,lower.tail) is near 1.  Accuracy can be
maintained in that case by replacing the existing calculation with
  log1p(-pchisq(x,df,ncp,!lower.tail))

Comment 1 Jitterbug compatibility account 2010-02-25 17:36:00 UTC
NOTES:
 No example given, and is this for ncp specified or not?
E.g.
> pchisq(100, 4, log.p=TRUE)
[1] -9.836624e-21
> log1p(-pchisq(100, 4, lower.tail = FALSE))
[1] -9.836624e-21
> pchisq(100, 4, ncp=1, log.p=TRUE)
[1] 0
> log1p(-pchisq(100, 4, ncp=1, lower.tail = FALSE))
[1] -3.488174e-18

The latter is changed for 2.11.0

Comment 2 Jitterbug compatibility account 2010-02-25 17:36:42 UTC
Audit (from Jitterbug):
Thu Feb 25 11:36:42 2010	ripley	changed notes
Thu Feb 25 11:36:42 2010	ripley	moved from incoming to Accuracy-fixed