[Rd] Accuracy (PR#13999)

Ben Bolker bolker at ufl.edu
Sun Oct 11 19:47:44 CEST 2009





witkovsky wrote:
> 
> Full_Name: Viktor Witkovsky
> Version: 2.9.2
> OS: Windows XP
> Submission from: (NULL) (78.98.89.227)
> 
> 
> Hello,
> 
> I have found strange behavior of the function qchisq (the non-central
> qchisq is
> based on inversion of pchisq, which is further based on pgamma). The
> function
> gives wrong results without any warning. For example:
> 
> qchisq(1e-12,1,8.94^2,lower.tail=FALSE) gives 255.1840972465858 (notice
> that
> here the correct value should be 255.1841334848075),
> but
> qchisq(1e-12,1,8.95^2,lower.tail=FALSE) gives 1249.681320136836
> Here, the correct value should be 255.5037231613135.
> 
> So, it seems that qchisq is inaccurate for small probability values and
> larger
> non/centrality parameter.
> 
> 
> I am using the precompiled binary version of R, under Windows XP.
> 
>                _                           
> platform       i386-pc-mingw32             
> arch           i386                        
> os             mingw32                     
> system         i386, mingw32               
> status                                     
> major          2                           
> minor          9.2                         
> year           2009                        
> month          08                          
> day            24                          
> svn rev        49384                       
> language       R                           
> version.string R version 2.9.2 (2009-08-24)
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

More entertainingly (and perhaps enlighteningly?)

> curve(qchisq(1e-12,1,x^2,lower.tail=FALSE),from=0.1,to=50)

 Of course, I haven't taken the time to dig through and see
what's happening :-(

> sessionInfo()
R version 2.9.2 (2009-08-24) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  grid      methods  
[8] base     

other attached packages:
[1] reshape_0.8.3 plyr_0.1.9    proto_0.3-8  

loaded via a namespace (and not attached):
[1] ggplot2_0.8.4

-- 
View this message in context: http://www.nabble.com/Accuracy-%28PR-13999%29-tp25843737p25845807.html
Sent from the R devel mailing list archive at Nabble.com.



More information about the R-devel mailing list