I am using the imhof and the farebrother methods intensively for 
computing the p-value of a certain statistical test. Thus I detected 
that, in some cases, both methods have some difficulties when the 
quantiles are extreme:

- imhof sometimes gives negative values. For example:
     > imhof(1.729879e+01,0.5)
     $Qq
     [1] -0.01641256

     $abserr
     [1] 0.0004728838

- farebrother gives the value 3 if the quantile is zero. (Since the 
distribution of the underlying test statistic is asymptotically given by 
those of a quadratic form, the value zero indeed occurs.)
     > farebrother(0,0.5)
     $lambda
     [1] 0.5

     $h
     [1] 1

     $delta
     [1] 0

     $r
     [1] 1

     $q
     [1] 0

     $mode
     [1] 1

     $maxit
     [1] 100000

     $eps
     [1] 1e-10

     $dnsty
     [1] 0

     $ifault
     [1] 2

     $res
     [1] 3

Do you have an idea what the reason could be?

Best regards,
Stefan Aulbach
Email: stefan.aulbach@uni-wuerzburg.de
http://www.statistik-mathematik.uni-wuerzburg.de/en/mitarbeiter/stefan_aulbach/

##################################################################################


Dear  Dr Pierre Lafaye de Micheaux,

I am postdoc at the Netherlands Cancer Institute and currently work on non-nested hypotheses testing. In a recent work (http://arxiv.org/abs/1210.4584v2) the test-statistic which I propose is asymptotically distributed as a weighted-sum-of-chi-squares. There are  no non-centrality parameters involved, however the weights can be negative. I use this test in a multiple testing scenario and therefore I need an approximation which is accurate also for very small p-values.

I have recently read your very interesting paper on a comparison of several methods and have a question concerning your R package CompQuadForm:

Which function can you recommend me to use for my problem (computing accurate, small p-values based on weighted-sum-of-chi-squares with pos. and neg. weights)? If I understand correctly the farebrother approach requires positive weights. I tried davies and imhof. I have the impression that I can obtain smaller p-values (e.g. of the order 10^-10) with imhof, whereas  davies gives me a value of zero.

I am very thankful for any kind of thoughts or help !

Best wishes from Amsterdam,

Nicolas
"n.stadler" <staedler.n@gmail.com>

##################################################################################

Dear P. Lafaye de Micheaux,

I am using your R package CompQuadForm to calculate p-values. But the p-values could be too small, e.g., less than 10^{-8}. Is it possible to get the too small p-value with accuracy less than 10^{-9}?

I tried an example using three methods and got different results as follows:
Q=200
> davies(Q,c(6,3,1))$Qq
[1] 0
> farebrother(Q,c(6,3,1),eps=10^{-13})$res
[1] 1.224786e-08
> imhof(Q,c(6,3,1),epsabs=10^(-13))$Qq
[1] -1.092451e-07
So which method gives a correct value? And why is imhof's p-value negative?

Thank you.

Best regards,
ChangJiang


In Mathematica, I obtain a positive value:
0.5+NIntegrate[Sin[(ArcTan[6*u]+ArcTan[3*u]+ArcTan[u]-200*u)/2]/(u*(1+36*u^2)^(1/4)*(1+9*u^2)^(1/4)*(1+u^2)^(1/4)),{u,0,+Infinity}]/Pi

The problem comes from numerical precision. I should consider using a multiple-precision library (see www.mpfr.org or www.boost.org/doc/libs/1_60_0/libs/multiprecision) in my C code.

####################################################################################


My name is Zhonghua Liu, a student in biostatistics from Harvard. I am using your CompQuadForm R package to compute p values which might require high accuracy. 

I tried the following R code and obtain the following:

> davies(200,c(1,2,3),lim=900000,acc =0.0000000000001)
$trace
[1] 0.000000e+00 0.000000e+00 0.000000e+00 3.141588e-02 8.425265e+04 5.436841e-05 5.600000e+01

$ifault
[1] 1

$Qq
[1] 2


The Qq should be within [0,1], would you let me know how to fix this? Thanks a lot!

"Zhonghua Liu" <zhl618@mail.harvard.edu>

####################################################################
