bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] [Bug] gsl_cdf_tdist_P returns inaccurate p-value


From: Peter Johansson
Subject: Re: [Bug-gsl] [Bug] gsl_cdf_tdist_P returns inaccurate p-value
Date: Mon, 9 Jan 2017 11:02:45 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hi Woody,


On 01/07/2017 07:27 AM, Lin, Kuan-Ting wrote:
Hi all,

I am using gsl_cdf_tdist_P to get a p-value for the following two arrays:

x = 1, 2, 4, 2, 3, 1, 2, 4, 2, 1, 2
y = 11, 12, 13, 12, 13, 11, 14, 11, 12, 13, 12

(2* (1-gsl_cdf_tdist_P)) returns "8.882e-16”, but I got "9.189e-16” from 
t.test(x,y,var.equal=T) function in R (a statistics language). It suggests that 
gsl_cdf_tdist_P function is not returning a precise p-value.

The problem is that you are comparing 1.0 with something that very close 1.0 and your system does not have precision to that subtraction accurately. I suggest you replace '1-gsl_cdf_tdist_P' with 'gsl_cdf_tdist_Q', which in theory should be identical, but due to precision (rounding errors) the latter will be more correct.

In addition, I noticed that (2* (1-gsl_cdf_tdist_P)) doesn’t return double 
numbers. Instead, any p-value smaller than 1e-16 will be 0.

Same thing. Try gsl_cdf_tdist_Q.


Could someone help me with this?

Thanks,
Woody






reply via email to

[Prev in Thread] Current Thread [Next in Thread]