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
